Example #1
0
        /// <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 CefSettings.browser_subprocess_path 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.
        ///
        /// If the browser process was initialized with a valid render process startup callback,
        /// the render main thread will be redirected through the remoting interface into the
        /// browser process. The browser process' render process startup callback routine
        /// is then responsible for calling CfrRuntime.ExecuteProcess() and the |application|
        /// parameter will be ignored.
        ///
        /// The chromium sandbox is currently not supported within ChromiumFX.
        /// </summary>
        public static int ExecuteProcess(CfxApp application)
        {
            CfxApi.Probe();

            var cmd = Environment.CommandLine;
            var ex  = new System.Text.RegularExpressions.Regex(@"cfxremote=(\w+)");
            var m   = ex.Match(cmd);

            if (m.Success)
            {
                return(Chromium.Remote.RemoteClient.ExecuteProcess(m.Groups[1].Value));
            }
            else
            {
                return(ExecuteProcessInternal(application));
            }
        }
Example #2
0
        /// <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 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 CefSettings.browser_subprocess_path 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.
        ///
        /// If the browser process was initialized with a valid render process startup callback,
        /// the render main thread will be redirected through the remoting interface into the
        /// browser process. The browser process' render process startup callback routine
        /// is then responsible for calling CfrRuntime.ExecuteProcess() and the |application|
        /// parameter will be ignored.
        ///
        /// The chromium sandbox is currently not supported within ChromiumFX.
        /// </summary>
        public static int ExecuteProcess(CfxApp application)
        {
            CfxApi.Probe();

            var cmd = Environment.CommandLine;
            var ex  = new System.Text.RegularExpressions.Regex(@"cfxremote=(\w+)");
            var m   = ex.Match(cmd);

            if (m.Success)
            {
                if (application != null)
                {
                    throw new Exception("Can't handle user provided CfxApp object when the remote layer IPC bridge is in use.");
                }
                return(Chromium.Remote.RemoteClient.ExecuteProcess(m.Groups[1].Value));
            }
            else
            {
                return(ExecuteProcessInternal(application));
            }
        }
Example #4
0
 public static string GetChromeVersion()
 {
     CfxApi.Probe();
     return(String.Format("{0}.{1}.{2}.{3}", VersionInfo(2), VersionInfo(3), VersionInfo(4), VersionInfo(5)));
 }
Example #5
0
 public static string GetCefVersion()
 {
     CfxApi.Probe();
     return(String.Format("{0}.{1}.{2}", VersionInfo(0), VersionInfo(4), VersionInfo(1)));
 }
Example #6
0
 /// <summary>
 /// This function should be called on the main application thread to initialize
 /// the CEF browser process with support for the remote interface to the render
 /// process. The |application| parameter may be NULL. A return value of true (1)
 /// indicates that it succeeded and false (0) indicates that it failed.
 ///
 /// If |renderProcessMain| is provided, then every newly created render process
 /// main thread will be redirected through this callback and the callee is
 /// responsible for calling CfrRuntime.ExecuteProcess() from within the
 /// scope of this callback.
 ///
 /// The chromium sandbox is currently not supported within ChromiumFX.
 /// </summary>
 public static bool Initialize(CfxSettings settings, CfxApp application, CfxRenderProcessMainDelegate renderProcessMain)
 {
     CfxApi.Probe();
     Chromium.Remote.RemoteService.Initialize(renderProcessMain, ref application);
     return(Initialize(settings, application));
 }