Ejemplo n.º 1
0
        void RenderProcessHandler_OnUncaughtException(object sender, CfrOnUncaughtExceptionEventArgs e)
        {
            var wb = HtmlUILauncher.GetBrowser(e.Browser.Identifier);

            if (wb != null)
            {
            }
        }
Ejemplo n.º 2
0
 private void LocalSchemeHandlerFactory_Create(object sender, Chromium.Event.CfxSchemeHandlerFactoryCreateEventArgs e)
 {
     if (e.SchemeName.Equals("local") && e.Browser != null)
     {
         var browser = HtmlUILauncher.GetBrowser(e.Browser.Identifier);
         var handler = new LocalResourceHandler(browser);
         e.SetReturnValue(handler);
     }
 }
Ejemplo n.º 3
0
 private void EmbeddedSchemeHandlerFactory_Create(object sender, Chromium.Event.CfxSchemeHandlerFactoryCreateEventArgs e)
 {
     if (e.SchemeName == SchemeName && e.Browser != null)
     {
         var browser = HtmlUILauncher.GetBrowser(e.Browser.Identifier);
         var handler = new EmbeddedResourceHandler(resourceAssembly, browser);
         e.SetReturnValue(handler);
     }
 }
Ejemplo n.º 4
0
        void RenderProcessHandler_OnContextCreated(object sender, CfrOnContextCreatedEventArgs e)
        {
            var wb = HtmlUILauncher.GetBrowser(e.Browser.Identifier);

            if (wb != null)
            {
                if (e.Frame.IsMain)
                {
                    SetProperties(e.Context, wb.GlobalObject);
                }
                else
                {
                    JSObject obj;
                    if (wb.FrameGlobalObjects.TryGetValue(e.Frame.Name, out obj))
                    {
                        SetProperties(e.Context, obj);
                    }
                }
                wb.RaiseOnV8ContextCreated(e);
            }
        }
Ejemplo n.º 5
0
        void RenderProcessHandler_OnContextCreated(object sender, CfrOnContextCreatedEventArgs e)
        {
            var wb = HtmlUILauncher.GetBrowser(e.Browser.Identifier);

            if (wb != null)
            {
                if (e.Frame.IsMain)
                {
                    SetProperties(e.Context, wb.GlobalObject);
                    //TODO:添加内置的-nanui-[cmd]支持
                    e.Frame.ExecuteJavaScript(Properties.Resources.InitialScripts, e.Frame.Url, 0);
                }
                else
                {
                    JSObject obj;
                    if (wb.FrameGlobalObjects.TryGetValue(e.Frame.Name, out obj))
                    {
                        SetProperties(e.Context, obj);
                    }
                }
                wb.RaiseOnV8ContextCreated(e);
            }
        }
Ejemplo n.º 6
0
        void RenderProcessHandler_OnBrowserCreated(object sender, CfrOnBrowserCreatedEventArgs e)
        {
            var id = e.Browser.Identifier;
            var wb = HtmlUILauncher.GetBrowser(id);

            if (wb != null)
            {
                var rp = wb.RemoteProcess;
                if (rp != null && rp != this.remoteProcess)
                {
                    // A new process has been created for the browser.
                    // The old process is still alive, but probably it gets
                    // killed soon after this callback returns.
                    // So we suspend all callbacks from the old process.
                    // If there are currently executing callbacks,
                    // this call will block until they are finished.
                    // When this call returns, it should be safe to
                    // continue execution and let the old process die.
                    CfxRemoteCallbackManager.SuspendCallbacks(rp.RemoteProcessId);
                }

                wb.SetRemoteBrowser(e.Browser, remoteProcess);
            }
        }