Ejemplo n.º 1
0
        protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            // Prevent a separate gpu-process renderer process from being started.
            commandLine.AppendSwitch("in-process-gpu");

            Logger.Info("{0} process started with commandline arguments : {1}",
                        string.IsNullOrEmpty(processType) ? "Browser" : processType, commandLine.ToString());

            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());
            }
        }
Ejemplo n.º 3
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());
            }
        }
Ejemplo n.º 4
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());
            }
        }
Ejemplo n.º 5
0
 protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine)
 {
     Log.Trace("BrowserProcessHandler.OnBeforeChildProcessLaunch( commandLine: {0} )", commandLine.ToString());
     base.OnBeforeChildProcessLaunch(commandLine);
 }
Ejemplo n.º 6
0
        ///////////////////////////////////////////////////////////////////////

        protected override void OnBeforeCommandLineProcessing(String processType, CefCommandLine commandLine)
        {
            Log.Trace("App.OnBeforeCommandLineProcessing( processType: {0}, commandLine: {1} )", processType, commandLine.ToString());
            base.OnBeforeCommandLineProcessing(processType, commandLine);
        }