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> /// 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"); } // .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 = PathUtility.Application; 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"); } } if (!BaseMainApplication.Current.EnableD3D11 && !commandLine.GetArguments().Contains(Argument.DisableD3D11.Value)) { commandLine.AppendArgument(Argument.DisableD3D11.Value); } }
/// <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")); } }
protected override void OnBeforeChildProcessLaunch(CefCommandLine commandLine) { if (!commandLine.HasSwitch(CmdAssemblySearchPathSwitch)) { var searchPath = Path.GetDirectoryName(typeof(IPluginEvaluate).Assembly.Location); commandLine.AppendSwitch(CmdAssemblySearchPathSwitch, searchPath); } base.OnBeforeChildProcessLaunch(commandLine); }
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 }
/// <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 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); }
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); }
protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine) { // only happens if configuration is bad if (arguments != null) { foreach (String argument in arguments) { string normalizedArgument = argument; if (argument.StartsWith("--")) { if (argument.Length > 2) { normalizedArgument = argument.Substring(2); } else { Console.WriteLine( "BrowserApp::OnBeforeCommandLineProcessing bad argument {0}", argument); continue; } } int argSplitIndex = normalizedArgument.IndexOf('='); if (argSplitIndex >= 0) { string name = normalizedArgument.Substring(0, argSplitIndex); string value = normalizedArgument.Substring(argSplitIndex + 1); if (value.StartsWith("\"") && value.EndsWith("\"")) { value = value.Substring(1, value.Length - 2); } commandLine.AppendSwitch(name, value); } else { commandLine.AppendSwitch(normalizedArgument); } } } // If these were not manually specified then // try to add pepflashplayer.dll if (!commandLine.HasSwitch("ppapi-out-of-process") && !commandLine.HasSwitch("register-pepper-plugins")) { string flashPluginPath = Path.Combine( CLRBrowserSourcePlugin.AssemblyDirectory, "CLRBrowserSourcePlugin", "pepflashplayer.dll"); if (File.Exists(flashPluginPath)) { commandLine.AppendSwitch("ppapi-out-of-process"); string flashPluginValue = flashPluginPath + ";application/x-shockwave-flash"; commandLine.AppendSwitch("register-pepper-plugins", flashPluginValue); } } }