/// <summary> /// Create a new browser window using the window parameters specified by |windowInfo|. /// All values will be copied internally and the actual window will be created on the UI thread. /// This method call will not block. /// </summary> public static void Create(CefWindowInfo windowInfo, CefClient client, string url, CefBrowserSettings settings) { if (windowInfo == null) { throw new ArgumentNullException("windowInfo"); } if (client == null) { throw new ArgumentNullException("client"); } if (settings == null) { throw new ArgumentNullException("settings"); fixed(char *url_str = url) { cef_string_t n_url = new cef_string_t(url_str, url != null ? url.Length : 0); var result = NativeMethods.cef_browser_create( windowInfo.NativePointer, client.GetNativePointerAndAddRef(), &n_url, settings.NativePointer ); if (result == 0) { throw new InvalidOperationException("CefBrowser.Create error."); } } }
/// <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); }
/// <summary> /// Create a new browser window using the window parameters specified by |windowInfo|. /// This method should only be called on the UI thread. /// </summary> public static CefBrowser CreateSync(CefWindowInfo windowInfo, CefClient client, string url, CefBrowserSettings settings) { if (windowInfo == null) { throw new ArgumentNullException("windowInfo"); } if (client == null) throw new ArgumentNullException("client"); }
/// <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> protected virtual bool OnBeforePopup( CefBrowser parentBrowser, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, string url, ref CefClient client, CefBrowserSettings settings ) { return false; }
/// <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> protected virtual bool OnBeforePopup( CefBrowser parentBrowser, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, string url, ref CefClient client, CefBrowserSettings settings ) { return(false); }
/// <summary> /// Create a new browser window using the window parameters specified by |windowInfo|. /// This method should only be called on the UI thread. /// </summary> public static CefBrowser CreateSync(CefWindowInfo windowInfo, CefClient client, string url, CefBrowserSettings settings) { if (windowInfo == null) throw new ArgumentNullException("windowInfo"); if (client == null) throw new ArgumentNullException("client"); if (settings == null) throw new ArgumentNullException("settings"); fixed (char* url_str = url) { cef_string_t n_url = new cef_string_t(url_str, url != null ? url.Length : 0); var browser = NativeMethods.cef_browser_create_sync( windowInfo.NativePointer, client.GetNativePointerAndAddRef(), &n_url, settings.NativePointer ); if (browser == null) throw new InvalidOperationException("CefBrowser.CreateSync error."); return CefBrowser.From(browser); } }