示例#1
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);
        }
        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);
        }