internal static int ExecuteProcessInternal(CfxApp application) { switch (CfxApi.PlatformOS) { case CfxPlatformOS.Windows: return(ExecuteProcessPrivate(null, application, IntPtr.Zero)); case CfxPlatformOS.Linux: using (var mainArgs = CfxMainArgs.ForLinux()) { var retval = ExecuteProcessPrivate(mainArgs, application, IntPtr.Zero); mainArgs.mainArgsLinux.Free(); return(retval); } default: throw new CfxException("Unsupported platform."); } }
/// <summary> /// This function should be called on the main application thread to initialize /// the CEF browser process. The |application| parameter may be NULL. A return /// value of true (1) indicates that it succeeded and false (0) indicates that it /// failed. /// /// The chromium sandbox is currently not supported within ChromiumFX. /// </summary> public static bool Initialize(CfxSettings settings, CfxApp application) { CfxApi.Probe(); switch (CfxApi.PlatformOS) { case CfxPlatformOS.Windows: return(InitializePrivate(null, settings, application, IntPtr.Zero)); case CfxPlatformOS.Linux: using (var mainArgs = CfxMainArgs.ForLinux()) { var retval = InitializePrivate(mainArgs, settings, application, IntPtr.Zero); mainArgs.mainArgsLinux.Free(); return(retval); } default: throw new CfxException(); } }
/// <summary> /// This function should be called on the main application thread to initialize /// the CEF browser process. The |application| parameter may be NULL. A return /// value of true (1) indicates that it succeeded and false (0) indicates that it /// failed. The |windowsSandboxInfo| parameter is only used on Windows and may /// be NULL (see cef_sandbox_win.h for details). /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_app_capi.h">cef/include/capi/cef_app_capi.h</see>. /// </remarks> private static bool InitializePrivate(CfxMainArgs args, CfxSettings settings, CfxApp application, IntPtr windowsSandboxInfo) { return(0 != CfxApi.cfx_initialize(CfxMainArgs.Unwrap(args), CfxSettings.Unwrap(settings), CfxApp.Unwrap(application), windowsSandboxInfo)); }
/// <summary> /// This function should be called from the application entry point function to /// execute a secondary process. It can be used to run secondary processes from /// the browser client executable (default behavior) or from a separate /// executable specified by the CfxSettings.BrowserSubprocessPath value. If /// called for the browser process (identified by no "type" command-line value) /// it will return immediately with a value of -1. If called for a recognized /// secondary process it will block until the process should exit and then return /// the process exit code. The |application| parameter may be NULL. The /// |windowsSandboxInfo| parameter is only used on Windows and may be NULL (see /// cef_sandbox_win.h for details). /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_app_capi.h">cef/include/capi/cef_app_capi.h</see>. /// </remarks> private static int ExecuteProcessPrivate(CfxMainArgs args, CfxApp application, IntPtr windowsSandboxInfo) { return(CfxApi.cfx_execute_process(CfxMainArgs.Unwrap(args), CfxApp.Unwrap(application), windowsSandboxInfo)); }