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")); } }
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); }
/// <summary> /// Called before a child process is launched. Will be called on the browser /// process UI thread when launching a render process and on the browser /// process IO thread when launching a GPU or plugin process. Provides an /// opportunity to modify the child process command line. Do not keep a /// reference to |command_line| outside of this method. /// </summary> protected virtual void OnBeforeChildProcessLaunch(CefCommandLine commandLine) { }
/// <summary> /// Provides an opportunity to view and/or modify command-line arguments before /// processing by CEF and Chromium. The |process_type| value will be empty for /// the browser process. Do not keep a reference to the CefCommandLine object /// passed to this method. The CefSettings.command_line_args_disabled value /// can be used to start with an empty command-line object. Any values /// specified in CefSettings that equate to command-line arguments will be set /// before this method is called. Be cautious when using this method to modify /// command-line arguments for non-browser processes as this may result in /// undefined behavior including crashes. /// </summary> protected virtual void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine) { }
/// <summary> /// Launches the process specified via |command_line|. Returns true upon /// success. Must be called on the browser process TID_PROCESS_LAUNCHER thread. /// /// Unix-specific notes: /// - All file descriptors open in the parent process will be closed in the /// child process except for stdin, stdout, and stderr. /// - If the first argument on the command line does not contain a slash, /// PATH will be searched. (See man execvp.) /// </summary> public static bool LaunchProcess(CefCommandLine commandLine) { if (commandLine == null) throw new ArgumentNullException("commandLine"); return libcef.launch_process(commandLine.ToNative()) != 0; }
/// <summary> /// Returns a writable copy of this object. /// </summary> public CefCommandLine Copy() { return(CefCommandLine.FromNative(cef_command_line_t.copy(_self))); }
/// <summary> /// Create a new CefCommandLine instance. /// </summary> public static CefCommandLine Create() { return(CefCommandLine.FromNative(cef_command_line_t.create())); }