示例#1
0
 protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
 {
     //禁止使用gpu 加速 在headless 模式下  gpu 有问题
     //参考 http://www.cnblogs.com/koangel/p/5396975.html
     //https://bitbucket.org/xilium/xilium.cefglue/commits/4146c2b46923593f55d28c7435f017631f86dca0
     //commandLine.AppendSwitch("renderer-process-limit", "1");//限制render process 的数目
     //commandLine.AppendSwitch("process-per-tab");
     commandLine.AppendSwitch("disable-gpu");
     commandLine.AppendSwitch("disable-gpu-compositing");
     commandLine.AppendSwitch("enable-begin-frame-scheduling");
     commandLine.AppendSwitch("disable-smooth-scrolling");
 }
示例#2
0
        /// <summary>
        /// Called before child process launch.
        /// </summary>
        /// <param name="commandLine">The command line.</param>
        protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
        {
            if (commandLine == null)
            {
                throw new ArgumentNullException("commandLine");
            }

            if (!Application.Current.D3D11Enabled && !commandLine.GetArguments().Contains(Argument.DisableD3D11.Value))
            {
                commandLine.AppendArgument(Argument.DisableD3D11.Value);
            }
        }
        protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
        {
            Debug.WriteLine(DBGPREFIX + "OnBeforeChildProcessLaunch");
            var handler = OnBeforeChildProcessLaunchEvent;

            if (handler != null)
            {
                Debug.WriteLine(DBGPREFIX + "OnBeforeChildProcessLaunch Delegate");
                var e = new OnBeforeChildProcessLaunchEventArgs(commandLine);
                handler(this, e);
            }
        }
示例#4
0
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            if (commandLine.HasSwitch(CmdAssemblySearchPathSwitch))
            {
                var searchPath = commandLine.GetSwitchValue(CmdAssemblySearchPathSwitch);
                AppDomain.CurrentDomain.AssemblyResolve += (sender, resolveEventArgs) =>
                {
                    var assemblyName     = new AssemblyName(resolveEventArgs.Name);
                    var assemblyFileName = assemblyName.Name + ".dll";
                    var assemblyLocation = Path.Combine(searchPath, assemblyFileName);
                    if (File.Exists(assemblyLocation))
                    {
                        return(Assembly.LoadFrom(assemblyLocation));
                    }
                    return(null);
                };
            }
            if (string.IsNullOrEmpty(processType))
            {
                // Taken from: https://bitbucket.org/chromiumembedded/cef/commits/e3c1d8632eb43c1c2793d71639f3f5695696a5e8
                // If the PDF extension is enabled then cc Surfaces must be disabled for
                // PDFs to render correctly.
                // See https://bitbucket.org/chromiumembedded/cef/issues/1689 for details.
                if (!commandLine.HasSwitch("disable-extensions") && !commandLine.HasSwitch("disable-pdf-extension"))
                {
                    commandLine.AppendSwitch("disable-surfaces");
                }

                // Use software rendering and compositing (disable GPU) for increased FPS
                // and decreased CPU usage. This will also disable WebGL so remove these
                // switches if you need that capability.
                // See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details.
                if (!commandLine.HasSwitch("enable-gpu"))
                {
                    commandLine.AppendSwitch("disable-gpu");
                    commandLine.AppendSwitch("disable-gpu-compositing");
                }

                // Synchronize the frame rate between all processes. This results in
                // decreased CPU usage by avoiding the generation of extra frames that
                // would otherwise be discarded. The frame rate can be set at browser
                // creation time via CefBrowserSettings.windowless_frame_rate or changed
                // dynamically using CefBrowserHost::SetWindowlessFrameRate. In cefclient
                // it can be set via the command-line using `--off-screen-frame-rate=XX`.
                // See https://bitbucket.org/chromiumembedded/cef/issues/1368 for details.
                commandLine.AppendSwitch("enable-begin-frame-scheduling");

                //commandLine.AppendSwitch("disable-smooth-scrolling");
                commandLine.AppendSwitch("enable-system-flash");
            }
            base.OnBeforeCommandLineProcessing(processType, commandLine);
        }
        /// <summary>
        /// The on before child process launch.
        /// </summary>
        /// <param name="browser_cmd">
        /// The command line.
        /// </param>
        protected override void OnBeforeChildProcessLaunch(CefCommandLine browser_cmd)
        {
            // Disable security features
            browser_cmd.AppendSwitch("default-encoding", "utf-8");
            browser_cmd.AppendSwitch("allow-file-access-from-files");
            browser_cmd.AppendSwitch("allow-universal-access-from-files");
            browser_cmd.AppendSwitch("disable-web-security");
            browser_cmd.AppendSwitch("ignore-certificate-errors");

            if (_config.DebuggingMode)
            {
                Console.WriteLine("On CefGlue child process launch arguments:");
                Console.WriteLine(browser_cmd.ToString());
            }
        }
 protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
 {
     if (commandLine.GetSwitchValue("type").StartsWith("render"))
     {
         if (_disableSpellChecking)
         {
             commandLine.AppendArgument("--disable-spell-checking");
         }
         else if (!string.IsNullOrEmpty(_spellCheckLanguage) && !_spellCheckLanguage.Equals("en-US"))
         {
             commandLine.AppendArgument(string.Format("--override-spell-check-lang={0}", _spellCheckLanguage));
         }
     }
     base.OnBeforeChildProcessLaunch(commandLine);
 }
示例#7
0
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            Console.WriteLine("OnBeforeCommandLineProcessing: {0} {1}", processType, commandLine);

            // TODO: currently on linux platform location of locales and pack files are determined
            // incorrectly (relative to main module instead of libcef.so module).
            // Once issue http://code.google.com/p/chromiumembedded/issues/detail?id=668 will be resolved this code can be removed.
            if (CefRuntime.Platform == CefRuntimePlatform.Linux)
            {
                var path = new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath;
                path = Path.GetDirectoryName(path);

                commandLine.AppendSwitch("resources-dir-path", path);
                commandLine.AppendSwitch("locales-dir-path", Path.Combine(path, "locales"));
            }
        }
示例#8
0
文件: App.cs 项目: Fsamot/HtmlUi
        /// <summary>
        /// Called before command line processing.
        /// </summary>
        /// <param name="processType">Type of the process.</param>
        /// <param name="commandLine">The command line.</param>
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            if (commandLine == null)
            {
                throw new ArgumentNullException("commandLine");
            }

            if (!commandLine.HasSwitch("resources-dir-path"))
            {
                commandLine.AppendSwitch("resources-dir-path", PathUtility.WorkingDirectory);
            }

            if (!commandLine.HasSwitch("locales-dir-path"))
            {
                commandLine.AppendSwitch("locales-dir-path", Path.Combine(PathUtility.WorkingDirectory, "locales"));
            }
        }
示例#9
0
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            Console.WriteLine("OnBeforeCommandLineProcessing: {0} {1}", processType, commandLine);

            // TODO: currently on linux platform location of locales and pack files are determined
            // incorrectly (relative to main module instead of libcef.so module).
            // Once issue http://code.google.com/p/chromiumembedded/issues/detail?id=668 will be resolved
            // this code can be removed.
            if (CefRuntime.Platform == CefRuntimePlatform.Linux)
            {
                var path = new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath;
                path = Path.GetDirectoryName(path);

                commandLine.AppendSwitch("resources-dir-path", path);
                commandLine.AppendSwitch("locales-dir-path", Path.Combine(path, "locales"));
            }
        }
示例#10
0
 protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
 {
     if (commandLine.HasSwitch(CmdAssemblySearchPathSwitch))
     {
         var searchPath = commandLine.GetSwitchValue(CmdAssemblySearchPathSwitch);
         AppDomain.CurrentDomain.AssemblyResolve += (sender, resolveEventArgs) =>
         {
             var assemblyName     = new AssemblyName(resolveEventArgs.Name);
             var assemblyFileName = assemblyName.Name + ".dll";
             var assemblyLocation = Path.Combine(searchPath, assemblyFileName);
             if (File.Exists(assemblyLocation))
             {
                 return(Assembly.LoadFrom(assemblyLocation));
             }
             return(null);
         };
     }
     base.OnBeforeCommandLineProcessing(processType, commandLine);
 }
示例#11
0
        /// <summary>
        /// The on before command line processing.
        /// </summary>
        /// <param name="processType">
        /// The process type.
        /// </param>
        /// <param name="commandLine">
        /// The command line.
        /// </param>
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            // Get all custom command line argument switches
            if (_config?.CommandLineArgs != null)
            {
                foreach (var commandArg in _config.CommandLineArgs)
                {
                    commandLine.AppendSwitch(commandArg.Key ?? string.Empty, commandArg.Value);
                }
            }

            if (_config?.CommandLineOptions != null)
            {
                foreach (var commmandOption in _config?.CommandLineOptions)
                {
                    commandLine.AppendSwitch(commmandOption ?? string.Empty);
                }
            }
        }
示例#12
0
 //GPU and others
 protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
 {
     if (string.IsNullOrEmpty(processType))
     {
         // commandLine.AppendSwitch("enable-webrtc");
         if (!_enableGPU)
         {
             commandLine.AppendSwitch("disable-gpu");
             commandLine.AppendSwitch("disable-gpu-compositing");
         }
         commandLine.AppendSwitch("enable-begin-frame-scheduling");
         commandLine.AppendSwitch("disable-smooth-scrolling");
         if (_enableWebRtc)
         {
             commandLine.AppendSwitch("enable-media-stream", "true");
         }
     }
     //commandLine.AppendArgument("--enable-media-stream");
 }
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            if (noProxyServer && !commandLine.HasSwitch("--no-proxy-server"))
            {
                commandLine.AppendSwitch("--no-proxy-server");
            }

            if (mediaStreamingEnabled && !commandLine.HasSwitch("--enable-media-stream"))
            {
                commandLine.AppendSwitch("--enable-media-stream");
            }

#if LINUX
            if (!commandLine.HasSwitch("--no-zygote"))
            {
                commandLine.AppendSwitch("--no-zygote");
            }
#endif
        }
示例#14
0
        protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
        {
            commandLine.AppendSwitch("default-encoding", "utf-8");
            commandLine.AppendArgument("--allow-file-access-from-files");
            commandLine.AppendArgument("--allow-universal-access-from-files");
            commandLine.AppendArgument("--disable-web-security");
            commandLine.AppendArgument("--ignore-certificate-errors");


            WinFormium.Runtime.ChromiumEnvironment.CommandLineConfigurations?.Invoke(commandLine);

            commandLine.AppendSwitch("--libcef-dir-path", WinFormium.Runtime.ChromiumEnvironment.LibCefDir);
            commandLine.AppendSwitch("--host-process-id", System.Diagnostics.Process.GetCurrentProcess().Id.ToString());

            if (WinFormium.Runtime.IsDebuggingMode)
            {
                logger.Debug("On CefGlue child process launch arguments:");
                logger.Verbose(commandLine.ToString());
            }
        }
示例#15
0
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            System.Console.WriteLine("Entering OnBeforeCommandLineProcessing");

            // https://simpleit.rocks/linux/ubuntu/fixing-common-google-chrome-gpu-process-error-message-in-linux/
            commandLine.AppendSwitch("headless");
            commandLine.AppendSwitch("no-sandbox");
            commandLine.AppendSwitch("single-process");
            commandLine.AppendSwitch("disable-software-rasterizer");

            commandLine.AppendSwitch("disable-gpu");
            commandLine.AppendSwitch("disable-gpu-compositing");

            commandLine.AppendSwitch("disable-extensions");
            commandLine.AppendSwitch("disable-pinch");

            System.Console.WriteLine("Entering base.OnBeforeCommandLineProcessing");
            base.OnBeforeCommandLineProcessing(processType, commandLine);
            System.Console.WriteLine("Exiting  OnBeforeCommandLineProcessing");
        }
示例#16
0
        /// <summary>
        /// The on before command line processing.
        /// </summary>
        /// <param name="processType">
        /// The process type.
        /// </param>
        /// <param name="commandLine">
        /// The command line.
        /// </param>
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            // Get all custom command line argument switches
            if (_config?.CommandLineArgs != null)
            {
                foreach (var commandArg in _config.CommandLineArgs)
                {
                    commandLine.AppendSwitch(commandArg.Item1 ?? string.Empty, commandArg.Item2);
                }
            }

            if (_config?.CommandLineOptions != null)
            {
                foreach (var commmandOption in _config?.CommandLineOptions)
                {
                    commandLine.AppendSwitch(commmandOption ?? string.Empty);
                }
            }

            // Currently on linux platform location of locales and pack files are determined
            // incorrectly (relative to main module instead of libcef.so module).
            // Once issue http://code.google.com/p/chromiumembedded/issues/detail?id=668 will be resolved
            // this code can be removed.
            if (CefRuntime.Platform == CefRuntimePlatform.Linux)
            {
                if (string.IsNullOrEmpty(processType) || processType.Contains("zygote"))
                {
                    commandLine.AppendSwitch("no-zygote");
                }


                commandLine.AppendArgument("--disable-gpu");
                commandLine.AppendArgument("--disable-software-rasterizer");

                commandLine.AppendSwitch("disable-gpu", "1");
                commandLine.AppendSwitch("disable-software-rasterizer", "1");

                commandLine.AppendSwitch("resources-dir-path", _config.AppExeLocation);
                commandLine.AppendSwitch("locales-dir-path", Path.Combine(_config.AppExeLocation, "locales"));
            }
        }
 protected override void OnBeforeCommandLineProcessing(
     string processType,
     CefCommandLine commandLine)
 {
     if (!string.IsNullOrEmpty(processType))
     {
         return;
     }
     commandLine.AppendSwitch("disable-gpu");
     commandLine.AppendSwitch("disable-gpu-compositing");
     commandLine.AppendSwitch("disable-smooth-scrolling");
     commandLine.AppendSwitch("--enable-system-flash");
     commandLine.AppendSwitch("ppapi-flash-path", Path.Combine(RegistryManager.Instance.CefDataPath, "pepflashplayer.dll"));
     commandLine.AppendSwitch("plugin-policy", "allow");
     commandLine.AppendSwitch("enable-media-stream", "1");
     if (!this.mDevToolEnable)
     {
         return;
     }
     commandLine.AppendSwitch("enable-begin-frame-scheduling");
 }
示例#18
0
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            base.OnBeforeCommandLineProcessing(processType, commandLine);
#if DEBUG
            //Log.Debug(TAG, "ChromiumWebBrowser_OnBeforeCommandLineProcessing");
            //Log.Debug(TAG, commandLine.CommandLineString);
#endif

            //commandLine.AppendSwitchWithValue("proxy-server", "127.0.0.1:8888");

            //commandLine.AppendSwitchWithValue("remote-debugging-port", "9222");
            //commandLine.AppendSwitch("off-screen-rendering-enabled");
            //commandLine.AppendSwitchWithValue("off-screen-frame-rate", "30");

            //if (ThisAssembly.Debuggable)
            //{
            //    //enable-devtools-experiments
            //    commandLine.AppendSwitch("enable-devtools-experiments");
            //}

            //e.CommandLine.AppendSwitchWithValue("user-agent", "Mozilla/5.0 (Windows 10.0) WebKa/" + DateTime.UtcNow.Ticks);

            //("force-device-scale-factor", "1");

            commandLine.AppendSwitchWithValue("disable-gpu", "1");
            commandLine.AppendSwitchWithValue("disable-gpu-compositing", "1");
            commandLine.AppendSwitchWithValue("disable-gpu-vsync", "1");
            commandLine.AppendSwitchWithValue("disable-gpu-shader-disk-cache", "1");

            //commandLine.AppendSwitch("enable-begin-frame-scheduling");
            //commandLine.AppendSwitch("enable-media-stream");

            //if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            //{
            //    commandLine.AppendSwitch("no-zygote");
            //    commandLine.AppendSwitch("no-sandbox");
            //}

            //commandLine.AppendSwitch("disable-web-security"); // LoginUsingSteamClient
        }
示例#19
0
        protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
        {
            Console.WriteLine("AppendExtraCommandLineSwitches: {0}", commandLine);
            Console.WriteLine(" Program == {0}", commandLine.GetProgram());

            // .NET in Windows treat assemblies as native images, so no any magic required.
            // Mono on any platform usually located far away from entry assembly, so we want prepare command line to call it correctly.
            if (Type.GetType("Mono.Runtime") != null)
            {
                if (!commandLine.HasSwitch("cefglue"))
                {
                    var path = new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath;
                    commandLine.SetProgram(path);

                    var mono = CefRuntime.Platform == CefRuntimePlatform.Linux ? "/usr/bin/mono" : @"C:\Program Files\Mono-2.10.8\bin\monow.exe";
                    commandLine.PrependArgument(mono);

                    //commandLine.AppendSwitch("disable-web-security", "1");

                    //commandLine.AppendSwitch("high-dpi-support", "1");
                    //commandLine.AppendSwitch("force-device-scale-factor", "1");

                    //commandLine.AppendSwitch("no-proxy-server", "1");
                    //commandLine.AppendSwitch("no-sandbox");

                    //commandLine.AppendSwitch("disable-gpu", "1");
                    //commandLine.AppendSwitch("disable-gpu-compositing", "1");
                    //commandLine.AppendSwitch("enable-begin-frame-scheduling", "1");
                    // commandLine.AppendSwitch("disable-smooth-scrolling", "1");

                    commandLine.AppendSwitch("--disable-web-security");
                    commandLine.AppendSwitch("--user-data-dir");
                    commandLine.AppendSwitch("--allow-file-access-to-files");
                    commandLine.AppendSwitch("--enable-media-stream");
                    commandLine.AppendSwitch("cefglue", "w");
                }
            }

            Console.WriteLine("  -> {0}", commandLine);
        }
示例#20
0
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            base.OnBeforeCommandLineProcessing(processType, commandLine);

            Console.WriteLine("ChromiumWebBrowser_OnBeforeCommandLineProcessing");
            Console.WriteLine(commandLine.CommandLineString);

            //commandLine.AppendSwitchWithValue("proxy-server", "127.0.0.1:8888");


            //commandLine.AppendSwitchWithValue("remote-debugging-port", "9222");
            commandLine.AppendSwitch("off-screen-rendering-enabled");
            commandLine.AppendSwitchWithValue("off-screen-frame-rate", "30");

            //enable-devtools-experiments
            //commandLine.AppendSwitch("enable-devtools-experiments");

            //e.CommandLine.AppendSwitchWithValue("user-agent", "Mozilla/5.0 (Windows 10.0) WebKa/" + DateTime.UtcNow.Ticks);

            //("force-device-scale-factor", "1");

            commandLine.AppendSwitch("--disable-gpu");
            commandLine.AppendSwitch("enable-web-security");
            commandLine.AppendSwitch("--disable-software-rasterizer");
            commandLine.AppendSwitch("--disable-webgl");
            //--disable-webgl
            //commandLine.AppendSwitch("disable-gpu-compositing");
            //commandLine.AppendSwitch("disable-gpu-vsync");

            commandLine.AppendSwitch("enable-begin-frame-scheduling");
            commandLine.AppendSwitch("enable-media-stream");
            //commandLine.AppendSwitch("disable-javascript");

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                commandLine.AppendSwitch("--no-zygote");
                commandLine.AppendSwitch("--no-sandbox");
            }
        }
示例#21
0
文件: App.cs 项目: Fsamot/HtmlUi
        /// <summary>
        /// Called before command line processing.
        /// </summary>
        /// <param name="processType">Type of the process.</param>
        /// <param name="commandLine">The command line.</param>
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            if (commandLine == null)
            {
                throw new ArgumentNullException("commandLine");
            }

            if (!commandLine.HasSwitch("resources-dir-path"))
            {
                commandLine.AppendSwitch("resources-dir-path", PathUtility.WorkingDirectory);
            }

            if (!commandLine.HasSwitch("locales-dir-path"))
            {
                commandLine.AppendSwitch("locales-dir-path", Path.Combine(PathUtility.WorkingDirectory, "locales"));
            }

            if (!BaseMainApplication.Current.EnableD3D11 && !commandLine.GetArguments().Contains(Argument.DisableD3D11.Value))
            {
                commandLine.AppendArgument(Argument.DisableD3D11.Value);
            }
        }
        protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
        {
            Console.WriteLine("AppendExtraCommandLineSwitches: {0}", commandLine);
            Console.WriteLine(" Program == {0}", commandLine.GetProgram());

            // .NET in Windows treat assemblies as native images, so no any magic required.
            // Mono on any platform usually located far away from entry assembly, so we want prepare command line to call it correctly.
            if (Type.GetType("Mono.Runtime") != null)
            {
                if (!commandLine.HasSwitch("cefglue"))
                {
                    var path = new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath;
                    commandLine.SetProgram(path);

                    var mono = CefRuntime.Platform == CefRuntimePlatform.Linux ? "/usr/bin/mono" : @"C:\Program Files\Mono-2.10.8\bin\monow.exe";
                    commandLine.PrependArgument(mono);

                    commandLine.AppendSwitch("cefglue", "w");
                }
            }

            Console.WriteLine("  -> {0}", commandLine);
        }
示例#23
0
        /// <summary>
        /// The on before command line processing.
        /// </summary>
        /// <param name="processType">
        /// The process type.
        /// </param>
        /// <param name="commandLine">
        /// The command line.
        /// </param>
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            // Get all custom command line argument switches
            if ((this.HostConfig != null) && (this.HostConfig.CommandLineArgs != null))
            {
                foreach (var commandArg in this.HostConfig.CommandLineArgs)
                {
                    commandLine.AppendSwitch(commandArg.Key, commandArg.Value);
                }
            }

            // Currently on linux platform location of locales and pack files are determined
            // incorrectly (relative to main module instead of libcef.so module).
            // Once issue http://code.google.com/p/chromiumembedded/issues/detail?id=668 will be resolved
            // this code can be removed.
            if (CefRuntime.Platform == CefRuntimePlatform.Linux)
            {
                var path = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);

                commandLine.AppendSwitch("resources-dir-path", path);
                commandLine.AppendSwitch("locales-dir-path", Path.Combine(path, "locales"));
            }
        }
示例#24
0
 protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
 {
     commandLine.AppendSwitch("disable-gpu", "1");
     commandLine.AppendSwitch("off-screen-rendering-enabled", "1");
 }
示例#25
0
 protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
 {
     //CMCS.Common.Utilities.Log4Neter.Info(processType + "     " + commandLine.ToString());
 }
示例#26
0
 protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
 {
     ;
 }
示例#27
0
 public void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
 {
     _application.OnBeforeChildProcessLaunch(new BeforeChildProcessLaunchEventArgs(commandLine));
 }
            protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
            {
                // TODO: currently on linux platform location of locales and pack files are determined
                // incorrectly (relative to main module instead of libcef.so module).
                // Once issue http://code.google.com/p/chromiumembedded/issues/detail?id=668 will be resolved this code can be removed.
                //if (CefRuntime.Platform != CefRuntimePlatform.Linux) return;
                var path = new Uri(Application.dataPath).LocalPath;

                //path = Path.GetDirectoryName(path);

                commandLine.AppendSwitch("resources-dir-path", path);
                commandLine.AppendSwitch("locales-dir-path", Path.Combine(path, "locales"));
                MelonModLogger.Log($"OnBeforeCommandLineProcessing: {processType} {commandLine}");
            }
示例#29
0
文件: App.cs 项目: ulkyome/HtmlUi
 /// <summary>
 /// Called before command line processing.
 /// </summary>
 /// <param name="processType">Type of the process.</param>
 /// <param name="commandLine">The command line.</param>
 protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
 {
     if (commandLine == null)
         throw new ArgumentNullException("commandLine");
 }
示例#30
0
 protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
 {
     base.OnBeforeChildProcessLaunch(commandLine);
 }
示例#31
0
        /// <summary>
        /// The on before child process launch.
        /// </summary>
        /// <param name="commandLine">
        /// The command line.
        /// </param>
        protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
        {
            // We need to know the process Id to establish WCF communication and for monitoring of parent process exit
            commandLine.AppendSwitch(SubprocessArguments.HostProcessIdArgument, Process.GetCurrentProcess().Id.ToString());
            commandLine.AppendSwitch(SubprocessArguments.ExitIfParentProcessClosed, "1");

            var schemeHandlerObjs = IoC.GetAllInstances(typeof(ChromelySchemeHandler));

            if (schemeHandlerObjs != null)
            {
                var schemeHandlers = schemeHandlerObjs.ToList();
                var argument       = string.Empty;
                foreach (var item in schemeHandlers)
                {
                    if (item is ChromelySchemeHandler handler)
                    {
                        bool isStandardScheme = UrlScheme.IsStandardScheme(handler.SchemeName);
                        if (!isStandardScheme)
                        {
                            argument += handler.SchemeName + SubprocessArguments.Separator;
                        }
                    }
                }

                argument = argument.TrimEnd(SubprocessArguments.Separator);
                commandLine.AppendSwitch(SubprocessArguments.CustomSchemeArgument, argument);
            }

            // Get all custom command line argument switches
            if (ChromelyConfiguration.Instance.CommandLineArgs != null)
            {
                var argument = string.Empty;
                foreach (var commandArg in ChromelyConfiguration.Instance.CommandLineArgs)
                {
                    if (commandArg.Item3)
                    {
                        argument += commandArg.Item1 + SubprocessArguments.ChildSeparator + commandArg.Item2 + SubprocessArguments.ChildSeparator + "T" + SubprocessArguments.Separator;
                    }
                    else
                    {
                        argument += string.Empty + SubprocessArguments.ChildSeparator + commandArg.Item2 + SubprocessArguments.ChildSeparator + "F" + SubprocessArguments.Separator;
                    }
                }

                // Disable security features
                argument += "default-encoding" + SubprocessArguments.ChildSeparator + "utf-8" + SubprocessArguments.ChildSeparator + "T" + SubprocessArguments.Separator;
                argument += string.Empty + SubprocessArguments.ChildSeparator + "allow-file-access-from-files" + SubprocessArguments.ChildSeparator + "F" + SubprocessArguments.Separator;
                argument += string.Empty + SubprocessArguments.ChildSeparator + "allow-universal-access-from-files" + SubprocessArguments.ChildSeparator + "F" + SubprocessArguments.Separator;
                argument += string.Empty + SubprocessArguments.ChildSeparator + "disable-web-security" + SubprocessArguments.ChildSeparator + "F" + SubprocessArguments.Separator;
                argument += string.Empty + SubprocessArguments.ChildSeparator + "ignore-certificate-errors" + SubprocessArguments.ChildSeparator + "F" + SubprocessArguments.Separator;

                argument = argument.TrimEnd(SubprocessArguments.Separator);
                commandLine.AppendSwitch(SubprocessArguments.CustomCmdlineArgument, argument);
            }

            // Disable security features
            commandLine.AppendSwitch("default-encoding", "utf-8");
            commandLine.AppendSwitch("allow-file-access-from-files");
            commandLine.AppendSwitch("allow-universal-access-from-files");
            commandLine.AppendSwitch("disable-web-security");
            commandLine.AppendSwitch("ignore-certificate-errors");

            if (ChromelyConfiguration.Instance.DebuggingMode)
            {
                Console.WriteLine("On CefGlue child process launch arguments:");
                Console.WriteLine(commandLine.ToString());
            }
        }