Ejemplo n.º 1
0
        private static int Main(string[] args)
        {
            try
            {
                Debug.WriteLine(DBGPREFIX + "Loading CefRuntime in Render Process");
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                Debug.WriteLine(DBGPREFIX + ex.ToString() );
                throw;
            }
            catch (CefRuntimeException ex)
            {
                Debug.WriteLine(DBGPREFIX + ex.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(DBGPREFIX + ex.ToString());
                throw;
            }

            var mainArgs = new CefMainArgs(args);
            var cefApp = new LVRenderCefApp();
            Debug.WriteLine(DBGPREFIX + "Starting ExecuteProcess");
            var exitCode = CefRuntime.ExecuteProcess(mainArgs, cefApp, IntPtr.Zero);
            if (exitCode == -1)
            {
                Debug.WriteLine(DBGPREFIX + "This process at the following path should not be run directly, specify as target in browser process: " + System.Windows.Forms.Application.ExecutablePath);
                throw new CefRuntimeException("Process should not be run directly, instead specify as target in browser process");
            }
            Debug.WriteLine(DBGPREFIX + "Finishing ExecuteProcess and exiting application");
            return exitCode;
        }
Ejemplo n.º 2
0
        private static int Main(string[] args)
        {
            try
            {
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                MessageBox.Show(ex.Message);
                return 1;
            }
            catch (CefRuntimeException ex)
            {
                MessageBox.Show(ex.Message);
                return 2;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return 3;
            }

            var mainArgs = new CefMainArgs(args);
            var app1 = new DemoApp();

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, app1);
            if (exitCode != -1)
                return exitCode;

            var settings = new CefSettings
            {
                // BrowserSubprocessPath = @"D:\fddima\Projects\Xilium\Xilium.CefGlue\CefGlue.Demo\bin\Release\Xilium.CefGlue.Demo.exe",
                SingleProcess = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Disable,
                LogFile = "CefGlue.log",
            };

            CefRuntime.Initialize(mainArgs, settings, app1);

            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);

            if (!settings.MultiThreadedMessageLoop)
            {
                //WApplication.Idle += (sender, e) => { CefRuntime.DoMessageLoopWork(); };
            }

            var app = new App();
            app.InitializeComponent();
            app.Run();

            CefRuntime.Shutdown();
            return 0;
        }
Ejemplo n.º 3
0
        static int Main(string[] args)
        {
            try
            {
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return 1;
            }
            catch (CefRuntimeException ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return 2;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return 3;
            }

            var mainArgs = new CefMainArgs(args);
            var app = new TrackboxApp();

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, app);
            if (exitCode != -1)
                return exitCode;

            var settings = new CefSettings
            {
                SingleProcess = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Disable,
                LogFile = "CefGlue.log",
            };

            CefRuntime.Initialize(mainArgs, settings, app);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!settings.MultiThreadedMessageLoop)
            {
                Application.Idle += (sender, e) => { CefRuntime.DoMessageLoopWork(); };
            }

            Application.Run(new MainForm());

            CefRuntime.Shutdown();
            return 0;
        }
        static int Main(String[] args)
        {
            LoadLibrary(Path.Combine(AssemblyDirectory, "d3dcompiler_43.dll"));
            LoadLibrary(Path.Combine(AssemblyDirectory, "d3dcompiler_46.dll"));
            LoadLibrary(Path.Combine(AssemblyDirectory, "libGLESv2.dll"));
            LoadLibrary(Path.Combine(AssemblyDirectory, "libEGL.dll"));
            LoadLibrary(Path.Combine(AssemblyDirectory, "ffmpegsumo.dll"));
            LoadLibrary(Path.Combine(AssemblyDirectory, "icudt.dll"));
            LoadLibrary(Path.Combine(AssemblyDirectory, "libcef.dll"));

            CefMainArgs mainArgs = new CefMainArgs(IntPtr.Zero, args);
            return CefRuntime.ExecuteProcess(mainArgs, new BrowserApp(), IntPtr.Zero);
        }
        public CefCoreSession(CefSettings iCefSettings, NeutroniumCefApp iCefApp, string[] iArgs)
        {
            _CefApp = iCefApp;
            _Args = iArgs;
            _CefSettings = iCefSettings;
            var mainArgs = new CefMainArgs(_Args);

            CefRuntime.Load();

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, _CefApp, IntPtr.Zero);
            if (exitCode != -1)
                throw ExceptionHelper.Get(string.Format("Unable to execute cef process: {0}", exitCode));

            CefRuntime.Initialize(mainArgs, _CefSettings, _CefApp, IntPtr.Zero);
        }
Ejemplo n.º 6
0
        public static int QuickInit(string[] args)
        {
            try
            {
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                throw new ApplicationException("ex.Message");
                return 1;
            }
            catch (CefRuntimeException ex)
            {
                throw new ApplicationException("ex.Message");
                return 2;
            }
            catch (Exception ex)
            {
                throw new ApplicationException("ex.Message");
                return 3;
            }

            var mainArgs = new CefMainArgs(args);
            var app = new MyCefApp();

            IntPtr windowsSandboxHandle = IntPtr.Zero;

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, app, windowsSandboxHandle);
            if (exitCode != -1)
                return exitCode;

            var settings = new CefSettings
            {
                SingleProcess = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Disable,
                LogFile = "CefGlue.log",
                Locale = CultureInfo.CurrentCulture.Name,
                 
            };


            settings.RemoteDebuggingPort = 2035;

            CefRuntime.Initialize(mainArgs, settings, app, windowsSandboxHandle);

            return 0;
        }
Ejemplo n.º 7
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 empty. The
        /// |windows_sandbox_info| parameter is only used on Windows and may be NULL (see
        /// cef_sandbox_win.h for details).
        /// </summary>
        public static int ExecuteProcess(CefMainArgs args, CefApp application, IntPtr windowsSandboxInfo)
        {
            LoadIfNeed();

            var n_args = args.ToNative();
            var n_app  = application != null?application.ToNative() : null;

            try
            {
                return(libcef.execute_process(n_args, n_app, (void *)windowsSandboxInfo));
            }
            finally
            {
                CefMainArgs.Free(n_args);
            }
        }
        public static int Main(String[] args)
        {
            String currentDirectory = AppDomain.CurrentDomain.BaseDirectory;
            String libraryDirectory = Path.Combine(currentDirectory, "CLRBrowserSourcePlugin");

            LoadLibrary(Path.Combine(libraryDirectory, "d3dcompiler_43.dll"));
            LoadLibrary(Path.Combine(libraryDirectory, "d3dcompiler_46.dll"));
            LoadLibrary(Path.Combine(libraryDirectory, "libGLESv2.dll"));
            LoadLibrary(Path.Combine(libraryDirectory, "libEGL.dll"));
            LoadLibrary(Path.Combine(libraryDirectory, "ffmpegsumo.dll"));
            LoadLibrary(Path.Combine(libraryDirectory, "icudt.dll"));
            LoadLibrary(Path.Combine(libraryDirectory, "libcef.dll"));

            CefMainArgs mainArgs = new CefMainArgs(args);
            return CefRuntime.ExecuteProcess(mainArgs, new BrowserApp());
        }
Ejemplo n.º 9
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 empty.
        /// </summary>
        public static int ExecuteProcess(CefMainArgs args, CefApp application)
        {
            LoadIfNeed();

            var n_args = args.ToNative();
            var n_app  = application != null?application.ToNative() : null;

            try
            {
                return(libcef.execute_process(n_args, n_app));
            }
            finally
            {
                CefMainArgs.Free(n_args);
            }
        }
Ejemplo n.º 10
0
        static CefGlueWebViewHandler()
        {
            xc.CefRuntime.Load();

            var mainArgs = new xc.CefMainArgs(null);
            var cefApp   = new MyCefApp();

            //var exitCode = xc.CefRuntime.ExecuteProcess(mainArgs, cefApp);
            //if (exitCode != -1) { return exitCode; }

            var cefSettings = new xc.CefSettings
            {
                SingleProcess            = true,
                MultiThreadedMessageLoop = true,
                LogSeverity = xc.CefLogSeverity.Disable,
            };

            xc.CefRuntime.Initialize(mainArgs, cefSettings, cefApp);
        }
Ejemplo n.º 11
0
        public int Initialize(bool isSubProcess, params string[] args)
        {
            var path = AppDomain.CurrentDomain.BaseDirectory;
            var binPath = isSubProcess ? path : Path.Combine(path, "bin");

            loggingService.Debug("[Initialize] cefPath: {0}", binPath);

            CefRuntime.Load(binPath);

            loggingService.Debug("[Initialize] Cef binaries found");

            var mainArgs = new CefMainArgs(args);

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, this, IntPtr.Zero);
            loggingService.Debug("[Initialize] exitCode: " + exitCode);

            if (exitCode != -1 || isSubProcess)
            {
                // Sub-process will return here
                return exitCode;
            }
            
            var settings = new CefSettings
            {
                SingleProcess = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Verbose,
                WindowlessRenderingEnabled = true,
                IgnoreCertificateErrors = true,
                PersistSessionCookies = false,
                BrowserSubprocessPath = Path.Combine(binPath, "Axh.PageTracker.SubProcess.exe"),
                LocalesDirPath = Path.Combine(binPath, "locales"),
                Locale = "en-GB",
                LogFile = "C:\\Temp\\Cef.log"
            };

            CefRuntime.Initialize(mainArgs, settings, this, IntPtr.Zero);
            this.isInitialized = true;

            loggingService.Debug("[Initialize] Success");
            return 0;
        }
        /// <summary>
        /// This function should be called on the main application thread to initialize
        /// the CEF browser process. The |application| parameter may be empty. A return
        /// value of true indicates that it succeeded and false indicates that it failed.
        /// The |windows_sandbox_info| parameter is only used on Windows and may be NULL
        /// (see cef_sandbox_win.h for details).
        /// </summary>
        public static void Initialize(CefMainArgs args, CefSettings settings, CefApp application, IntPtr windowsSandboxInfo)
        {
            LoadIfNeed();

            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            if (_initialized)
            {
                throw ExceptionBuilder.CefRuntimeAlreadyInitialized();
            }

            var n_main_args = args != null?args.ToNative() : null;

            var n_settings = settings.ToNative();
            var n_app      = application != null?application.ToNative() : null;

            try
            {
                if (libcef.initialize(n_main_args, n_settings, n_app, (void *)windowsSandboxInfo) != 0)
                {
                    _initialized = true;
                }
                else
                {
                    throw ExceptionBuilder.CefRuntimeFailedToInitialize();
                }
            }
            finally
            {
                CefMainArgs.Free(n_main_args);
                CefSettings.Free(n_settings);
            }
        }
Ejemplo n.º 13
0
        private void Load(string cachePath, string currentDir)
        {
            try
            {
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                ErrorAndExit(ex);
            }
            catch (CefRuntimeException ex)
            {
                ErrorAndExit(ex);
            }
            catch (Exception ex)
            {
                ErrorAndExit(ex);
            }

            var mainArgs = new CefMainArgs(new string[] { });
            var cefApp = new AppDirectCefApp();

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, cefApp);
            if (exitCode != -1)
            {
                ErrorAndExit(new Exception("CEF Failed to load"));
            }

            var cefSettings = new CefSettings
            {
                BrowserSubprocessPath = currentDir + Path.DirectorySeparatorChar + CefClientExe,
                SingleProcess = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Verbose,
                PersistSessionCookies = true,
                LogFile = "cef.log",
                CachePath = cachePath,
                IgnoreCertificateErrors = true
            };

            try
            {
                CefRuntime.Initialize(mainArgs, cefSettings, cefApp);
            }
            catch (CefRuntimeException ex)
            {
                ErrorAndExit(ex);
            }
        }
Ejemplo n.º 14
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 empty. The
        /// |windows_sandbox_info| parameter is only used on Windows and may be NULL (see
        /// cef_sandbox_win.h for details).
        /// </summary>
        public static int ExecuteProcess(CefMainArgs args, CefApp application, IntPtr windowsSandboxInfo)
        {
            LoadIfNeed();

            var n_args = args.ToNative();
            var n_app = application != null ? application.ToNative() : null;

            try
            {
                return libcef.execute_process(n_args, n_app, (void*)windowsSandboxInfo);
            }
            finally
            {
                CefMainArgs.Free(n_args);
            }
        }
Ejemplo n.º 15
0
        private static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            try
            {
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return 1;
            }
            catch (CefRuntimeException ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return 2;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return 3;
            }

            //hmm not working
            //Should maybe move to callback in render process vs can modify from browser process this way
            //Array.Resize(ref args, args.Length + 1);
            //args[args.Length - 1] = @"--log-file ""..\logs\LVCef.RenderApp.log""";
            //for (int i = 0; i < args.Length; i++)
            //    Debug.WriteLine("Render args[" + i +"]: " + args[i]);

            var mainArgs = new CefMainArgs(args);
            var exitCode = CefRuntime.ExecuteProcess(mainArgs, null, IntPtr.Zero);
            if (exitCode != -1)
                return exitCode;

            var settings = new CefSettings
            {
                //Relative path from \cef, make sure to set Working Directory to \cef, see README.md
                BrowserSubprocessPath = @"..\dotnet\LVCef.RenderApp\bin\Debug\LVCef.RenderApp.exe",
                SingleProcess = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Default,
                LogFile = @"..\logs\TestControlAppSimple.log",
            };

            CefRuntime.Initialize(mainArgs, settings, null, IntPtr.Zero);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!settings.MultiThreadedMessageLoop)
            {
                Application.Idle += (sender, e) => { CefRuntime.DoMessageLoopWork(); };
            }

            Application.Run(new TestControlAppSimpleForm());

            CefRuntime.Shutdown();
            return 0;
        }
        public void Start()
        {
            ManualResetEventSlim contextInitializedEvent =
                new ManualResetEventSlim();

            dispatcher.PostTask(new Action(() =>
            {
                CefRuntime.Load();
                CefMainArgs cefMainArgs = new CefMainArgs(IntPtr.Zero, new String[0]);
                BrowserRuntimeSettings settings = BrowserSettings.Instance.RuntimeSettings;

                isMultiThreadedMessageLoop = settings.MultiThreadedMessageLoop;
                isSingleProcess = BrowserSettings.Instance.RuntimeSettings.SingleProcess;

                string browserSubprocessPath = Path.Combine(AssemblyDirectory,
                    "CLRBrowserSourcePlugin", "CLRBrowserSourceClient.exe");

                CefSettings cefSettings = new CefSettings
                {
                    BrowserSubprocessPath = browserSubprocessPath,
                    CachePath = settings.CachePath,
                    CommandLineArgsDisabled = settings.CommandLineArgsDisabled,
                    IgnoreCertificateErrors = settings.IgnoreCertificateErrors,
                    JavaScriptFlags = settings.JavaScriptFlags,
                    Locale = settings.Locale,
                    LocalesDirPath = settings.LocalesDirPath,
                    LogFile = settings.LogFile,
                    LogSeverity = settings.LogSeverity,
                    MultiThreadedMessageLoop = settings.MultiThreadedMessageLoop,
                    NoSandbox = true,
                    PersistSessionCookies = settings.PersistSessionCookies,
                    ProductVersion = settings.ProductVersion,
                    RemoteDebuggingPort = settings.RemoteDebuggingPort,
                    ResourcesDirPath = settings.ResourcesDirPath,
                    SingleProcess = false,
                    UncaughtExceptionStackSize = settings.UncaughtExceptionStackSize,
                    WindowlessRenderingEnabled = true
                };

                string[] commandLineArgs = settings.CommandLineArgsDisabled ?
                    new String[0] : settings.CommandLineArguments;

                BrowserApp browserApp = new BrowserApp(
                    commandLineArgs, contextInitializedEvent);

                try
                {
                    CefRuntime.Initialize(cefMainArgs, cefSettings, browserApp, IntPtr.Zero);
                }
                catch (InvalidOperationException e)
                {
                    API.Instance.Log("Failed to initialize cef runtime");
                    contextInitializedEvent.Set();
                }

                CefRuntime.RegisterSchemeHandlerFactory("local", null, new AssetSchemeHandlerFactory());
                CefRuntime.RegisterSchemeHandlerFactory("http", "absolute", new AssetSchemeHandlerFactory());

                if (!settings.MultiThreadedMessageLoop)
                {
                    CefRuntime.RunMessageLoop();
                }
            }));

            contextInitializedEvent.Wait();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// This function should be called on the main application thread to initialize
        /// the CEF browser process. The |application| parameter may be empty. A return
        /// value of true indicates that it succeeded and false indicates that it failed.
        /// </summary>
        public static void Initialize(CefMainArgs args, CefSettings settings, CefApp application)
        {
            LoadIfNeed();

            if (args == null) throw new ArgumentNullException("args");
            if (settings == null) throw new ArgumentNullException("settings");

            if (_initialized) throw ExceptionBuilder.CefRuntimeAlreadyInitialized();

            var n_main_args = args.ToNative();
            var n_settings = settings.ToNative();
            var n_app = application != null ? application.ToNative() : null;

            try
            {
                if (libcef.initialize(n_main_args, n_settings, n_app) != 0)
                {
                    _initialized = true;
                }
                else
                {
                    throw ExceptionBuilder.CefRuntimeFailedToInitialize();
                }
            }
            finally
            {
                CefMainArgs.Free(n_main_args);
                CefSettings.Free(n_settings);
            }
        }
Ejemplo n.º 18
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 empty.
        /// </summary>
        public static int ExecuteProcess(CefMainArgs args, CefApp application)
        {
            LoadIfNeed();

            var n_args = args.ToNative();
            var n_app = application != null ? application.ToNative() : null;

            try
            {
                return libcef.execute_process(n_args, n_app);
            }
            finally
            {
                CefMainArgs.Free(n_args);
            }
        }
Ejemplo n.º 19
0
        private static void InitializeCefRuntime()
        {
            if( !IsSupportedByThisPlatform() )
                return;

            if( isCefRuntimeInitialized )
                throw new InvalidOperationException( "The CefRuntime is already initialized. Call ShutdownCefRuntime() before initializing it again." );

            if( PlatformInfo.Platform == PlatformInfo.Platforms.Windows )
                NativeLibraryManager.PreLoadLibrary( Path.Combine( "CefGlue", "libcef" ) );

            //delete log file
            string realLogFileName = VirtualFileSystem.GetRealPathByVirtual( "user:Logs\\WebBrowserControl_CefGlue.log" );
            try
            {
                if( File.Exists( realLogFileName ) )
                    File.Delete( realLogFileName );
            }
            catch { }

            try
            {
                CefRuntime.Load();
            }
            catch( DllNotFoundException ex )
            {
                Log.Error( "WebBrowserControl: InitializeCefRuntime: CefRuntime.Load(): " + ex.Message );
                return;
            }
            catch( CefRuntimeException ex )
            {
                Log.Error( "WebBrowserControl: InitializeCefRuntime: CefRuntime.Load(): " + ex.Message );
                return;
            }
            catch( Exception ex )
            {
                Log.Error( "WebBrowserControl: InitializeCefRuntime: CefRuntime.Load(): " + ex.Message );
                return;
            }

            var mainArgs = new CefMainArgs( null );
            var cefApp = new SimpleApp();

            var exitCode = CefRuntime.ExecuteProcess( mainArgs, cefApp, IntPtr.Zero );
            if( exitCode != -1 )
            {
                Log.Error( "WebBrowserControl: InitializeCefRuntime: CefRuntime.ExecuteProcess: Exit code: {0}", exitCode );
                return;
            }

            var cefSettings = new CefSettings
            {
                SingleProcess = true,
                WindowlessRenderingEnabled = true,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Verbose,
                LogFile = realLogFileName,
                BrowserSubprocessPath = "",
                CachePath = "",
            };

            //!!!!
            ///// <summary>
            ///// Set to <c>true</c> to disable configuration of browser process features using
            ///// standard CEF and Chromium command-line arguments. Configuration can still
            ///// be specified using CEF data structures or via the
            ///// CefApp::OnBeforeCommandLineProcessing() method.
            ///// </summary>
            //public bool CommandLineArgsDisabled { get; set; }

            //!!!!!mac
            ///// <summary>
            ///// The fully qualified path for the resources directory. If this value is
            ///// empty the cef.pak and/or devtools_resources.pak files must be located in
            ///// the module directory on Windows/Linux or the app bundle Resources directory
            ///// on Mac OS X. Also configurable using the "resources-dir-path" command-line
            ///// switch.
            ///// </summary>
            //public string ResourcesDirPath { get; set; }

            try
            {
                CefRuntime.Initialize( mainArgs, cefSettings, cefApp, IntPtr.Zero );
            }
            catch( CefRuntimeException ex )
            {
                Log.Error( "WebBrowserControl: InitializeCefRuntime: CefRuntime.Initialize: " + ex.Message );
                return;
            }

            isCefRuntimeInitialized = true;
        }
Ejemplo n.º 20
0
 public static void Initialize(CefMainArgs args, CefSettings settings, CefApp application)
 {
     Initialize(args, settings, application, IntPtr.Zero);
 }
        public void Start()
        {
            ManualResetEventSlim disposedEvent = new ManualResetEventSlim();

            dispatcher.Invoke(new Action(() =>
            {
                CefRuntime.Load();
                CefMainArgs cefMainArgs = new CefMainArgs(IntPtr.Zero, new String[0]);
                BrowserRuntimeSettings settings = BrowserSettings.Instance.RuntimeSettings;

                isMultiThreadedMessageLoop = settings.MultiThreadedMessageLoop;

                CefSettings cefSettings = new CefSettings
                {
                    BrowserSubprocessPath = @"plugins\CLRHostPlugin\CLRBrowserSourcePlugin\CLRBrowserSourcePipe.exe",
                    CachePath = settings.CachePath,
                    CommandLineArgsDisabled = settings.CommandLineArgsDisabled,
                    IgnoreCertificateErrors = settings.IgnoreCertificateErrors,
                    JavaScriptFlags = settings.JavaScriptFlags,
                    Locale = settings.Locale,
                    LocalesDirPath = settings.LocalesDirPath,
                    LogFile = settings.LogFile,
                    LogSeverity = settings.LogSeverity,
                    MultiThreadedMessageLoop = settings.MultiThreadedMessageLoop,
                    PersistSessionCookies = settings.PersistSessionCookies,
                    ProductVersion = settings.ProductVersion,
                    ReleaseDCheckEnabled = settings.ReleaseDCheckEnabled,
                    RemoteDebuggingPort = settings.RemoteDebuggingPort,
                    ResourcesDirPath = settings.ResourcesDirPath,
                    SingleProcess = settings.SingleProcess,
                    UncaughtExceptionStackSize = settings.UncaughtExceptionStackSize
                };

                BrowserApp browserApp = new BrowserApp(settings.CommandLineArgsDisabled ? new String[0] : settings.CommandLineArguments);

                CefRuntime.ExecuteProcess(cefMainArgs, browserApp);
                CefRuntime.Initialize(cefMainArgs, cefSettings, browserApp);

                CefRuntime.RegisterSchemeHandlerFactory("local", null, new AssetSchemeHandlerFactory());
                CefRuntime.RegisterSchemeHandlerFactory("http", "absolute", new AssetSchemeHandlerFactory());
            }));

            PluginManager.Initialize();
        }
Ejemplo n.º 22
0
 public static int ExecuteProcess(CefMainArgs args, CefApp application)
 {
     return(ExecuteProcess(args, application, IntPtr.Zero));
 }
Ejemplo n.º 23
0
 public static int ExecuteProcess(CefMainArgs args, CefApp application)
 {
     return ExecuteProcess(args, application, IntPtr.Zero);
 }
Ejemplo n.º 24
0
 public static void Initialize(CefMainArgs args, CefSettings settings, CefApp application)
 {
     Initialize(args, settings, application, IntPtr.Zero);
 }
Ejemplo n.º 25
0
        public static void Initialize()
        {
            if (!initialized)
            {
                CefRuntime.Load();

                var cefMainArgs = new CefMainArgs(new string[0]);
                var cefApp = new App();
                if (CefRuntime.ExecuteProcess(cefMainArgs, cefApp, IntPtr.Zero) != -1)
                {
                    Console.Error.WriteLine("Could not the secondary process.");
                }

                var cefSettings = new CefSettings
                {
                    SingleProcess = true,
                    MultiThreadedMessageLoop = true,
                    LogSeverity = CefLogSeverity.Disable
                };

                CefRuntime.Initialize(cefMainArgs, cefSettings, cefApp, IntPtr.Zero);

                initialized = true;
            }
        }