Example #1
0
        private void Initialize()
        {
            InitializeCef();

            chromium = new ChromiumBrowser();
            chromium.BrowserInitialized         += OnWebViewBrowserInitialized;
            chromium.LoadEnd                    += OnWebViewLoadEnd;
            chromium.LoadError                  += OnWebViewLoadError;
            chromium.TitleChanged               += OnWebViewTitleChanged;
            chromium.JavascriptContextCreated   += OnJavascriptContextCreated;
            chromium.JavascriptContextReleased  += OnJavascriptContextReleased;
            chromium.JavascriptUncaughException += OnJavascriptUncaughException;
            chromium.UnhandledException         += OnUnhandledException;

            chromium.RequestHandler     = new InternalRequestHandler(this);
            chromium.LifeSpanHandler    = new InternalLifeSpanHandler(this);
            chromium.ContextMenuHandler = new InternalContextMenuHandler(this);
            chromium.DialogHandler      = new InternalDialogHandler(this);
            chromium.DownloadHandler    = new InternalDownloadHandler(this);
            chromium.JSDialogHandler    = new InternalJsDialogHandler(this);
            chromium.DragHandler        = new InternalDragHandler(this);
            chromium.KeyboardHandler    = new InternalKeyboardHandler(this);

            disposables = new IDisposable[] {
                chromium,
                AsyncCancellationTokenSource
            };

            RegisterJavascriptObject(Listener.EventListenerObjName, EventsListener);

            ExtraInitialize();

            GlobalWebViewInitialized?.Invoke(this);
        }
Example #2
0
        private void Initialize()
        {
            WebViewLoader.Initialize(Settings);

            chromium = new ChromiumBrowser();
            chromium.BrowserInitialized         += OnWebViewBrowserInitialized;
            chromium.LoadEnd                    += OnWebViewLoadEnd;
            chromium.LoadError                  += OnWebViewLoadError;
            chromium.TitleChanged               += delegate { TitleChanged?.Invoke(); };
            chromium.JavascriptContextCreated   += OnJavascriptContextCreated;
            chromium.JavascriptContextReleased  += OnJavascriptContextReleased;
            chromium.JavascriptUncaughException += OnJavascriptUncaughException;
            chromium.UnhandledException         += (o, e) => ForwardUnhandledAsyncException(e.Exception);

            chromium.RequestHandler     = new InternalRequestHandler(this);
            chromium.LifeSpanHandler    = new InternalLifeSpanHandler(this);
            chromium.ContextMenuHandler = new InternalContextMenuHandler(this);
            chromium.DialogHandler      = new InternalDialogHandler(this);
            chromium.DownloadHandler    = new InternalDownloadHandler(this);
            chromium.JSDialogHandler    = new InternalJsDialogHandler(this);
            chromium.DragHandler        = new InternalDragHandler(this);
            chromium.KeyboardHandler    = new InternalKeyboardHandler(this);

            if (!Settings.OsrEnabled)
            {
                // having the handler (by default) seems to cause some focus troubles, enable only osr disabled
                chromium.FocusHandler = new InternalFocusHandler(this);
            }

            EditCommands = new EditCommands(chromium);

            disposables = new IDisposable[] {
                AsyncCancellationTokenSource,
                chromium // browser should be the last
            };

            ExtraInitialize();

            GlobalWebViewInitialized?.Invoke(this);
        }
Example #3
0
 internal EditCommands(ChromiumBrowser chromiumBrowser)
 {
     ChromiumBrowser = chromiumBrowser;
 }