Ejemplo n.º 1
0
        private int on_before_browser(cef_extension_handler_t *self, cef_extension_t *extension, cef_browser_t *browser, cef_browser_t *active_browser, int index, cef_string_t *url, int active, cef_window_info_t *windowInfo, cef_client_t **client, cef_browser_settings_t *settings)
        {
            CheckSelf(self);

            var m_extension     = CefExtension.FromNative(extension);
            var m_browser       = CefBrowser.FromNativeOrNull(browser);
            var m_activeBrowser = CefBrowser.FromNativeOrNull(active_browser);
            var m_url           = cef_string_t.ToString(url);
            var m_active        = active != 0;
            var m_windowInfo    = CefWindowInfo.FromNative(windowInfo);
            var m_client        = CefClient.FromNative(*client);
            var m_settings      = new CefBrowserSettings(settings);

            var o_client = m_client;
            var cancel   = OnBeforeBrowser(m_extension, m_browser, m_activeBrowser, index, m_url, m_active, m_windowInfo, ref m_client, m_settings);

            if (!cancel && ((object)o_client != m_client && m_client != null))
            {
                *client = m_client.ToNative();
            }

            m_windowInfo.Dispose();
            m_settings.Dispose();

            return(cancel ? 1 : 0);
        }
Ejemplo n.º 2
0
        private void on_extension_unloaded(cef_extension_handler_t *self, cef_extension_t *extension)
        {
            CheckSelf(self);

            var mExtension = CefExtension.FromNative(extension);

            OnExtensionUnloaded(mExtension);
        }
Ejemplo n.º 3
0
        private cef_browser_t *get_active_browser(cef_extension_handler_t *self, cef_extension_t *extension, cef_browser_t *browser, int include_incognito)
        {
            CheckSelf(self);

            var m_extension        = CefExtension.FromNative(extension);
            var m_browser          = CefBrowser.FromNative(browser);
            var m_includeIncognito = include_incognito != 0;

            var result = GetActiveBrowser(m_extension, m_browser, m_includeIncognito);

            return(result != null?result.ToNative() : null);
        }
Ejemplo n.º 4
0
        private int can_access_browser(cef_extension_handler_t *self, cef_extension_t *extension, cef_browser_t *browser, int include_incognito, cef_browser_t *target_browser)
        {
            CheckSelf(self);

            var m_extension       = CefExtension.FromNative(extension);
            var m_browser         = CefBrowser.FromNativeOrNull(browser);
            var m_includeIcognito = include_incognito != 0;
            var m_targetBrowser   = CefBrowser.FromNativeOrNull(target_browser);

            var result = CanAccessBrowser(m_extension, m_browser, m_includeIcognito, m_targetBrowser);

            return(result ? 1 : 0);
        }
Ejemplo n.º 5
0
        private int get_extension_resource(cef_extension_handler_t *self, cef_extension_t *extension, cef_browser_t *browser, cef_string_t *file, cef_get_extension_resource_callback_t *callback)
        {
            CheckSelf(self);

            var m_extension = CefExtension.FromNative(extension);
            var m_browser   = CefBrowser.FromNativeOrNull(browser);
            var m_file      = cef_string_t.ToString(file);
            var m_callback  = CefGetExtensionResourceCallback.FromNativeOrNull(callback);

            var handled = GetExtensionResource(m_extension, m_browser, m_file, m_callback);

            if (!handled)
            {
                m_callback.Dispose();
            }

            return(handled ? 1 : 0);
        }
Ejemplo n.º 6
0
        private int on_before_background_browser(cef_extension_handler_t *self, cef_extension_t *extension, cef_string_t *url, cef_client_t **client, cef_browser_settings_t *settings)
        {
            CheckSelf(self);

            var m_extension = CefExtension.FromNative(extension);
            var m_url       = cef_string_t.ToString(url);
            var m_client    = CefClient.FromNative(*client);
            var m_settings  = new CefBrowserSettings(settings);

            var o_client = m_client;
            var cancel   = OnBeforeBackgroundBrowser(m_extension, m_url, ref m_client, m_settings);

            if (!cancel && ((object)o_client != m_client && m_client != null))
            {
                *client = m_client.ToNative();
            }

            m_settings.Dispose();

            return(cancel ? 1 : 0);
        }