Ejemplo n.º 1
0
        /// <summary>
        /// Called before a new popup window is created.
        /// The |parentBrowser| parameter will point to the parent browser window.
        /// The |popupFeatures| parameter will contain information about the style of popup window requested.
        /// Return false to have the framework create the new popup window based on the parameters in |windowInfo|.
        /// Return true to cancel creation of the popup window.
        /// By default, a newly created popup window will have the same client and settings as the parent window.
        /// To change the client for the new window modify the object that |client| points to.
        /// To change the settings for the new window modify the |settings| structure.
        /// </summary>
        private int on_before_popup(cef_life_span_handler_t *self, cef_browser_t *parentBrowser, /*const*/ cef_popup_features_t *popupFeatures, cef_window_info_t *windowInfo, /*const*/ cef_string_t *url, cef_client_t **client, cef_browser_settings_t *settings)
        {
            ThrowIfObjectDisposed();

            var m_client        = CefClient.From(*client);
            var m_parentBrowser = CefBrowser.From(parentBrowser);
            var m_popupFeatures = CefPopupFeatures.From(popupFeatures);
            var m_windowInfo    = CefWindowInfo.From(windowInfo);
            var m_url           = cef_string_t.ToString(url);
            var m_settings      = CefBrowserSettings.From(settings);

            var o_client = m_client;
            var handled  = this.OnBeforePopup(m_parentBrowser, m_popupFeatures, m_windowInfo, m_url, ref m_client, m_settings);

            if (!handled && m_client != o_client && m_client != null)
            {
                *client = m_client.GetNativePointerAndAddRef();
            }

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

            return(handled ? 1 : 0);
        }