コード例 #1
0
        private void InitializeBrowser()
        {
            Cef.EnableHighDPISupport();

            string assemblyLocation = Assembly.GetExecutingAssembly().Location;
            string assemblyPath     = Path.GetDirectoryName(assemblyLocation);
            string pathSubprocess   = Path.Combine(assemblyPath, "CefSharp.BrowserSubprocess.exe");

            var settings = new CefSettings();

            settings.BrowserSubprocessPath = pathSubprocess;

            //the following setting is added to support Rhino 5.
            // With versions of CefSharp > 47.0.3, the content is rendered on 1/4 of the control area.
            // This setting fixes this, but at the consequence of disabling WebGL.
            // If you need WebGL in CefSharp and are targeting Rhino 5, use CefSharp 47.0.3 without this setting.
            settings.DisableGpuAcceleration();

            Cef.Initialize(settings);

            m_browser = new ChromiumWebBrowser("http://www.rhino3d.com/");
            Controls.Add(m_browser);
            m_browser.Dock    = DockStyle.Fill;
            m_browser.Enabled = true;
            m_browser.Show();
        }
コード例 #2
0
        /// <summary>
        /// ブラウザを初期化します。
        /// 最初の呼び出しのみ有効です。二回目以降は何もしません。
        /// </summary>
        void InitializeBrowser()
        {
            if (Browser != null)
            {
                return;
            }

            if (ProxySettings == null)
            {
                return;
            }


            var settings = new CefSettings()
            {
                BrowserSubprocessPath = Path.Combine(
                    AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                    @"CefEOBrowser\bin\CefSharp.BrowserSubprocess.exe"),
                CachePath          = BrowserCachePath,
                Locale             = "ja",
                AcceptLanguageList = "ja,en-US,en",                        // todo: いる?
                LogSeverity        = Configuration.SavesBrowserLog ? LogSeverity.Error : LogSeverity.Disable,
                LogFile            = "BrowserLog.log",
            };

            if (!Configuration.HardwareAccelerationEnabled)
            {
                settings.DisableGpuAcceleration();
            }

            settings.CefCommandLineArgs.Add("proxy-server", ProxySettings);
            settings.CefCommandLineArgs.Add("limit-fps", "60");            // limit browser fps to fix canvas crash
            // causes memory leak after Umikaze k2 update somehow...
            // settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"; // fix for 206 response from server for bgm
            if (Configuration.ForceColorProfile)
            {
                settings.CefCommandLineArgs.Add("force-color-profile", "srgb");
            }
            CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
            Cef.Initialize(settings, false, (IBrowserProcessHandler)null);


            var requestHandler = new RequestHandler(pixiSettingEnabled: Configuration.PreserveDrawingBuffer);

            requestHandler.RenderProcessTerminated += (mes) => AddLog(3, mes);

            Browser = new ChromiumWebBrowser(@"about:blank")
            {
                Dock            = DockStyle.Fill,
                Size            = SizeAdjuster.Size,
                RequestHandler  = requestHandler,
                MenuHandler     = new MenuHandler(),
                KeyboardHandler = new KeyboardHandler(),
                DragHandler     = new DragHandler(),
            };
            Browser.BrowserSettings.StandardFontFamily = "Microsoft YaHei";             // Fixes text rendering position too high
            Browser.LoadingStateChanged         += Browser_LoadingStateChanged;
            Browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
            SizeAdjuster.Controls.Add(Browser);
        }
コード例 #3
0
ファイル: ChromiumObject.cs プロジェクト: uvbs/WebGuard
        private ChromiumWebBrowser InitializeChromium(string url)
        {
            var settings = new CefSettings
            {
                BrowserSubprocessPath      = @"x86\CefSharp.BrowserSubprocess.exe",
                UncaughtExceptionStackSize = 0,
                LogSeverity = LogSeverity.Disable
            };

            settings.CefCommandLineArgs.Add("--disable-speech-api", "1");
            settings.CefCommandLineArgs.Add("--disable-low-res-tiling", "1");
            settings.CefCommandLineArgs.Add("--disable-threaded-scrolling", "1");
            settings.CefCommandLineArgs.Add("--disable-infobars", "1");
            settings.CefCommandLineArgs.Add("--disable-offline-auto-reload", "1");
            settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
            settings.CefCommandLineArgs.Add("--disable-smooth-scrolling", "1");
            settings.CefCommandLineArgs.Add("--disable-spell-checking", "1");
            settings.CefCommandLineArgs.Add("--disable-sync", "1");
            settings.CefCommandLineArgs.Add("disable-gpu", "1");
            settings.DisableGpuAcceleration();
            // Initialize cef with the provided settings
            Cef.Initialize(settings);
            var chromeBrowser = new ChromiumWebBrowser(url)
            {
                Dock           = DockStyle.Fill,
                Enabled        = false,
                RequestHandler = new CustomRequestHandler()
            };

            chromeBrowser.ConsoleMessage += ChromeBrowser_ConsoleMessage;
            Container.Controls.Add(chromeBrowser);
            return(chromeBrowser);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            if (args.Length != 0)
            {
                ServerIp = args[0];
            }

            var settings = new CefSettings
            {
                BrowserSubprocessPath      = @"x86\CefSharp.BrowserSubprocess.exe",
                UncaughtExceptionStackSize = 0,
                LogSeverity = LogSeverity.Disable
            };

            settings.CefCommandLineArgs.Add("--disable-speech-api", "1");
            settings.CefCommandLineArgs.Add("--disable-low-res-tiling", "1");
            settings.CefCommandLineArgs.Add("--disable-threaded-scrolling", "1");
            settings.CefCommandLineArgs.Add("--disable-infobars", "1");
            settings.CefCommandLineArgs.Add("--disable-offline-auto-reload", "1");
            //settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
            settings.CefCommandLineArgs.Add("--disable-smooth-scrolling", "1");
            settings.CefCommandLineArgs.Add("--disable-spell-checking", "1");
            settings.CefCommandLineArgs.Add("--disable-sync", "1");
            //settings.CefCommandLineArgs.Add("disable-gpu", "1");
            settings.CefCommandLineArgs.Add("--allow-file-access-from-files", "1");
            settings.DisableGpuAcceleration();
            settings.CefCommandLineArgs.Add("--disable-xss-auditor", "1");
            // Initialize cef with the provided settings
            Cef.Initialize(settings);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new MainForm());
        }
コード例 #5
0
        private static void InitializeCefSharp()
        {
            CefSharpSettings.ShutdownOnExit = true;
            CefSharpSettings.SubprocessExitIfParentProcessClosed = true;

            var path = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                                    Environment.Is64BitProcess ? "x64" : "x86",
                                    "CefSharp.BrowserSubprocess.exe");
            var settings = new CefSettings
            {
                CachePath             = "cache",
                UserAgent             = "RealEstate.App",
                BackgroundColor       = 0x00,
                LogFile               = "Debug.log",         //You can customise this path
                LogSeverity           = LogSeverity.Default, // You can change the log level
                BrowserSubprocessPath = path
            };

            settings.CefCommandLineArgs.Add("enable-media-stream", "1");
            settings.CefCommandLineArgs.Add("disable-gpu", "1");       // Disable GPU acceleration
            settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1"); //Disable GPU vsync
            settings.DisableGpuAcceleration();

            Cef.EnableHighDPISupport();
            Cef.Initialize(settings, true, browserProcessHandler: null);
        }
コード例 #6
0
        static AppContainer()
        {
            CefSettings cefSettings = new CefSettings();

            cefSettings.DisableGpuAcceleration();

            Cef.Initialize(cefSettings);
        }
コード例 #7
0
        /// <summary>
        /// ブラウザを初期化します。
        /// 最初の呼び出しのみ有効です。二回目以降は何もしません。
        /// </summary>
        void InitializeBrowser()
        {
            if (Browser != null)
            {
                return;
            }

            if (ProxySettings == null)
            {
                return;
            }


            var settings = new CefSettings()
            {
                BrowserSubprocessPath = Path.Combine(
                    AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                    Environment.Is64BitProcess ? "x64" : "x86",
                    "CefSharp.BrowserSubprocess.exe"),
                CachePath          = BrowserCachePath,
                Locale             = "ja",
                AcceptLanguageList = "ja,en-US,en",                        // todo: いる?
                LogSeverity        = LogSeverity.Error,
                LogFile            = "BrowserLog.log",
            };

            if (!Configuration.HardwareAccelerationEnabled)
            {
                settings.DisableGpuAcceleration();
            }

            settings.CefCommandLineArgs.Add("proxy-server", ProxySettings);
            if (Configuration.ForceColorProfile)
            {
                settings.CefCommandLineArgs.Add("force-color-profile", "srgb");
            }
            CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
            Cef.Initialize(settings, false, (IBrowserProcessHandler)null);


            var requestHandler = new RequestHandler(pixiSettingEnabled: Configuration.PreserveDrawingBuffer);

            requestHandler.RenderProcessTerminated += (mes) => AddLog(3, mes);

            Browser = new ChromiumWebBrowser(@"about:blank")
            {
                Dock            = DockStyle.None,
                Size            = SizeAdjuster.Size,
                RequestHandler  = requestHandler,
                MenuHandler     = new MenuHandler(),
                KeyboardHandler = new KeyboardHandler(),
                DragHandler     = new DragHandler(),
            };
            Browser.LoadingStateChanged         += Browser_LoadingStateChanged;
            Browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
            SizeAdjuster.Controls.Add(Browser);
        }
コード例 #8
0
 public App()
 {
     using (var settings = new CefSettings())
     {
         settings.SetOffScreenRenderingBestPerformanceArgs();
         settings.DisableGpuAcceleration();
         settings.Locale = CultureInfo.CurrentCulture.Name;
         Cef.Initialize(settings);
     }
 }
コード例 #9
0
        static TestApp()
        {
            // This is only so that generating a thumbnail for Aero peek works properly:  with GPU acceleration enabled, all you get is a black box
            // when you try to "snapshot" the web browser control.  If you don't plan on using Aero peek, remove this method.
            CefSettings cefSettings = new CefSettings();

            cefSettings.DisableGpuAcceleration();

            Cef.Initialize(cefSettings);
        }
コード例 #10
0
 static Browser()
 {
     settings = new CefSettings()
     {
         CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache"),
     };
     settings.CefCommandLineArgs.Add("process-per-tab", "1");
     settings.DisableGpuAcceleration();
     CefSharpSettings.ShutdownOnExit = true;
     Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
 }
コード例 #11
0
ファイル: Program.cs プロジェクト: maihcx/IDesign
        static void Main(string[] args)
        {
            //Properties.Settings.Default.FUser = "";
            //Properties.Settings.Default.FUser = "";
            //Properties.Settings.Default.FIsFirsStart = false;
            //Properties.Settings.Default.Save();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
            Cef.EnableHighDPISupport();
            var settings = new CefSettings()
            {
                CachePath = Path
                            .Combine(Environment
                                     .GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MessengerFB\\Cache")
            };

            settings.CefCommandLineArgs.Add("debug-plugin-loading", "1");
            settings.CefCommandLineArgs.Add("allow-outdated-plugins", "1");
            settings.CefCommandLineArgs.Add("always-authorize-plugins", "1");
            settings.CefCommandLineArgs.Add("disable-web-security", "1");
            settings.CefCommandLineArgs.Add("enable-npapi", "1");
            settings.CefCommandLineArgs.Add("enable-media-stream", "1");
            settings.CefCommandLineArgs.Add("enable_spellchecking", "0");
            settings.WindowlessRenderingEnabled = true;
            //settings.EnableNetSecurityExpiration = true;
            settings.BackgroundColor = Cef.ColorSetARGB(255, 85, 85, 85);
            if (Properties.Settings.Default.FStopGPU)
            {
                settings.SetOffScreenRenderingBestPerformanceArgs();
                settings.DisableGpuAcceleration();
            }
            settings.Locale             = "vi";
            settings.AcceptLanguageList = "en_US";
            Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

            //Application.Run(new frmMain());

            if (Properties.Settings.Default.FIsFirsStart)
            {
                frm = new frmMain();
                SingleInstanceApplication.Run(frm, NewInstanceHandler);
            }
            else
            {
                frm = new frmLogin();
                SingleInstanceApplication.Run(frm, NewInstanceHandler);
            }

            //frm1 = new frmIconTray();
            //SingleInstanceApplication.Run(frm1, NewInstanceHandlerNone);
            //Application.Run(new frmIconTray());
        }
コード例 #12
0
        public App()
        {
            Environment.CurrentDirectory = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

            var settings = new CefSettings()
            {
                CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache")
            };

            settings.DisableGpuAcceleration();
            Cef.EnableHighDPISupport();
            Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
        }
コード例 #13
0
        private void InitializeChromium(string proxy, string url)
        {
            var cef_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"CefEOBrowser");
            CefLibraryHandle libraryLoader = new CefLibraryHandle(Path.Combine(cef_path, @"bin\libcef.dll"));

            CefSettings settings = new CefSettings() {
                //LogFile = Path.Combine(cef_path, @"debug.log"),
                CachePath = Path.Combine(cef_path, @"cache"),
                UserDataPath = Path.Combine(cef_path, @"userdata"),
                ResourcesDirPath = Path.Combine(cef_path, @"bin"),
                LocalesDirPath = Path.Combine(cef_path, @"bin\locales"),
                BrowserSubprocessPath = Path.Combine(cef_path, @"bin\CefSharp.BrowserSubprocess.exe"),
                Locale = "ja",
                AcceptLanguageList = "ja-JP",
                LogSeverity = LogSeverity.Disable
            };
            settings.CefCommandLineArgs.Add("proxy-server", proxy);

            var nogpu = Directory.EnumerateFiles(cef_path, "nogpu*");
            if (nogpu.Any()) {
                settings.DisableGpuAcceleration();
                switch (BrowserUILanguage) {
                    case "zh":
                        AddLog(2, $"检测到文件 {nogpu.FirstOrDefault()},GPU 加速已禁用。");
                        break;
                    default:
                        AddLog(2, $"{nogpu.FirstOrDefault()} を検出されました、GPU アクセラレーションを無効にする。");
                        break;
                }
            }

            Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);

            Browser = new ChromiumWebBrowser(url) {
                FocusHandler = null,
                KeyboardHandler = new BrowserKeyboardHandler(),
                LifeSpanHandler = new BrowserLifeSpanHandler(),
                MenuHandler = new BrowserMenuHandler(),
                RequestHandler = new BrowserRequestHandler()
            };
            Browser.BrowserSettings.StandardFontFamily = "Microsoft YaHei"; // Fixes text rendering position too high

            Browser.Dock = DockStyle.Fill;
            Browser.AddressChanged += Browser_AddressChanged;
            Browser.FrameLoadStart += Browser_FrameLoadEnd;

            SizeAdjuster.Controls.Add(Browser);
            SizeAdjuster.SizeChanged += SizeAdjuster_SizeChanged;

            libraryLoader.Dispose();
        }
コード例 #14
0
        static void Main()
        {
            if (File.Exists("log.txt"))
            {
                File.Delete("log.txt");
            }

            Log.Logger = new LoggerConfiguration().MinimumLevel.Verbose().WriteTo.File("log.txt").CreateLogger();

            Log.Information("Starting RimworldModUpdater v{0}", Settings.Version);

            Log.Information($"Initializing Cef {Cef.CefSharpVersion} ({Cef.CefVersion}) chromium {Cef.ChromiumVersion}");

            Cef.EnableHighDPISupport();

            var settings = new CefSettings();

            settings.DisableGpuAcceleration();
            Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

            CefSharpSettings.LegacyJavascriptBindingEnabled = true;

            Application.ApplicationExit += delegate(object sender, EventArgs args)
            {
                Log.Information("Closing steamcmd instances before quit.");
                foreach (var process in Process.GetProcessesByName("steamcmd"))
                {
                    process.Kill();
                }
            };

            // Cleanup steamapps folder.
            if (Directory.Exists("steamcmd/steamapps"))
            {
                try
                {
                    Directory.Delete("steamcmd/steamapps", true);
                    Log.Information("Deleted old steamapps folder.");
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "Failed to cleanup steamapps folder (You can ignore this error).");
                }
            }

            Log.Information("Creating UpdaterForm");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new UpdaterForm());
        }
コード例 #15
0
        public static void Initialize()
        {
            CefSettings settings = new CefSettings();

            //CefSharpSettings.Proxy=new ProxyOptions(ip:"",port:"",username:)
            settings.CachePath = Application.StartupPath + "/CacheCef/" + InfomationStartup.IdDropzWindow;
            settings.UserAgent = Info.Setting.UserAgent;
            settings.DisableGpuAcceleration();
            settings = Proxy.ConfigProxy(settings);
            Cef.Initialize(settings);
            Browser.ChromeBrowser = new ChromiumWebBrowser("");//https://whoer.net/
            Browser.ChromeBrowser.LifeSpanHandler = new LifespanHandler();
            //Browser.ChromeBrowser.RequestHandler =new MyRequestHandler();
            Browser.ChromeBrowser.Dock = DockStyle.Fill;
        }
コード例 #16
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            var settings = new CefSettings();

            settings.IgnoreCertificateErrors    = true;
            settings.WindowlessRenderingEnabled = true;
            settings.DisableGpuAcceleration();

            Cef.Initialize(settings);
            var browser = new ChromiumWebBrowser("http://www.google.co.uk");

            Application.Run();
        }
コード例 #17
0
ファイル: frmMain.cs プロジェクト: BryceGre/RSWikit
 private static void InitializeChromium()
 {
     if (!Cef.IsInitialized)
     {
         //initialize chromium
         CefSettings settings = new CefSettings();
         settings.UserAgent        = "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19";
         settings.CachePath        = "cache";
         settings.ResourcesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"lib\");
         Console.WriteLine(settings.ResourcesDirPath);
         settings.LocalesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"lib\locales\");
         settings.DisableGpuAcceleration();
         settings.BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"lib\CefSharp.BrowserSubprocess.exe");
         // Initialize cef with the provided settings
         Cef.Initialize(settings, false, null);
     }
 }
コード例 #18
0
ファイル: Program.cs プロジェクト: dabrewdanya/VRCX
        public static void Main()
        {
            try
            {
                var settings = new CefSettings
                {
                    CachePath = "cache",
                    PersistUserPreferences     = true,
                    PersistSessionCookies      = true,
                    WindowlessRenderingEnabled = true
                };
                settings.CefCommandLineArgs.Add("ignore-certificate-errors", "1");
                settings.CefCommandLineArgs.Add("disable-web-security", "1");
                // settings.CefCommandLineArgs.Add("no-proxy-server", "1");
                settings.CefCommandLineArgs.Add("disable-plugins-discovery", "1");
                settings.CefCommandLineArgs.Add("disable-extensions", "1");
                settings.CefCommandLineArgs.Add("disable-pdf-extension", "1");
                settings.CefCommandLineArgs.Add("disable-gpu", "1");
                settings.CefCommandLineArgs.Add("disable-gpu-vsync", "1");
                // settings.CefCommandLineArgs.Add("disable-direct-write", "1");
                settings.LogSeverity = LogSeverity.Disable;
                settings.DisableGpuAcceleration();

                /*settings.RegisterScheme(new CefCustomScheme
                 * {
                 *  SchemeName = "vrcx",
                 *  DomainName = "app",
                 *  SchemeHandlerFactory = new FolderSchemeHandlerFactory(Application.StartupPath + "/../../../html")
                 * });*/

                // MUST TURN ON (Error when creating a browser on certain systems.)
                CefSharpSettings.WcfEnabled     = true;
                CefSharpSettings.ShutdownOnExit = false;
                CefSharpSettings.SubprocessExitIfParentProcessClosed = true;

                Cef.EnableHighDPISupport();

                if (Cef.Initialize(settings, true, browserProcessHandler: null))
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    VRCXStorage.Load();
                    SQLite.Init();
                    CpuMonitor.Init();
                    Discord.Init();
                    LogWatcher.Init();
                    VRCXVR.Init();
                    Application.Run(new MainForm());
                    VRCXVR.Exit();
                    LogWatcher.Exit();
                    Discord.Exit();
                    CpuMonitor.Exit();
                    SQLite.Exit();
                    VRCXStorage.Save();
                    Cef.Shutdown();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"{ex.Message}\n{ex.StackTrace}", "PLEASE REPORT TO PYPY", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }
コード例 #19
0
ファイル: ChromiumInit.cs プロジェクト: Doktorishka/ForksEvo
        public static void Init(Settings appSettings)
        {
            string      path1       = Path.Combine(ClientConfig.AppDataPath, "BrowserData");
            CefSettings cefSettings = new CefSettings()
            {
                LocalesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "locales"),
                UserAgent      = appSettings.UserSettings.FakeProfile.UserAgent
            };

            ChromiumInit.SetAcceptLanguageAndDnt(cefSettings, appSettings);
            if (cefSettings.CefCommandLineArgs.ContainsKey("enable-system-flash"))
            {
                cefSettings.CefCommandLineArgs.Remove("enable-system-flash");
            }
            if (!appSettings.UserSettings.UseMemoryChache)
            {
                cefSettings.CachePath             = Path.Combine(path1, "cache");
                cefSettings.PersistSessionCookies = true;
            }
            else
            {
                Random random = new Random(DateTime.Now.ToUnixTimestamp());
                cefSettings.CachePath              = Path.Combine(Path.GetTempPath(), "TheForks" + (object)random.Next(), new Random(DateTime.Now.ToUnixTimestamp() + random.Next()).Next().ToString(), "cache");
                cefSettings.PersistSessionCookies  = false;
                cefSettings.PersistUserPreferences = false;
            }
            cefSettings.LogFile     = Path.Combine(path1, "Log.txt");
            cefSettings.LogSeverity = LogSeverity.Error;
            if (cefSettings.CefCommandLineArgs.ContainsKey("enable-media-stream"))
            {
                cefSettings.CefCommandLineArgs.Remove("enable-media-stream");
            }
            cefSettings.CefCommandLineArgs.Add("enable-media-stream", "0");
            if (!appSettings.UserSettings.IsLoadImage)
            {
                cefSettings.CefCommandLineArgs.Add("disable-image-loading", "1");
            }
            cefSettings.IgnoreCertificateErrors = false;
            if (!cefSettings.CefCommandLineArgs.ContainsKey("force-device-scale-factor"))
            {
                cefSettings.CefCommandLineArgs.Remove("force-device-scale-factor");
            }
            cefSettings.CefCommandLineArgs.Add("force-device-scale-factor", "1");
            cefSettings.CefCommandLineArgs.Add("disable-pinch", "1");
            cefSettings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required";
            cefSettings.WindowlessRenderingEnabled            = true;
            if (!appSettings.UserSettings.IsUseWebGl)
            {
                cefSettings.DisableGpuAcceleration();
            }
            Api.IsSendDnt         = appSettings.UserSettings.IsSendDnt;
            Api.IsProtectedScreen = appSettings.UserSettings.IsFakeBrowserWindowsSize;
            cefSettings.RegisterScheme(new CefCustomScheme()
            {
                SchemeName           = "theforks",
                IsSecure             = true,
                SchemeHandlerFactory = (ISchemeHandlerFactory) new TheForksShemeFactory()
            });
            cefSettings.BrowserSubprocessPath = "TheForks.Browser.exe";
            Environment.SetEnvironmentVariable("GOOGLE_API_KEY", "AIzaSyAC7UA_YZ0gFB_RPYCnx73GXeFJJidyMv4");
            Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_ID", "486970647838-vs25am0f4etpkobmr437bhk8o98fa98v.apps.googleusercontent.com");
            Environment.SetEnvironmentVariable("GOOGLE_DEFAULT_CLIENT_SECRET", "PDy4q3AwPjG3_YOIXBH1j2VF");
            Api.IsBLockedScripts = appSettings.UserSettings.IsBlockedScripts;
            if (!Cef.IsInitialized && !Cef.Initialize(cefSettings))
            {
                throw new ArgumentException("Chrome не инициализирован");
            }
        }