/// <summary> /// Create a new browser window using the window parameters specified by /// |windowInfo|. If |request_context| is empty the global request context /// will be used. This method can only be called on the browser process UI /// thread. /// </summary> public static CefBrowser CreateBrowserSync(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, string url, CefRequestContext requestContext) { if (windowInfo == null) { throw new ArgumentNullException("windowInfo"); } if (client == null) { throw new ArgumentNullException("client"); } if (settings == null) { throw new ArgumentNullException("settings"); } // TODO: [ApiUsage] if windowInfo.WindowRenderingDisabled && client doesn't provide RenderHandler implementation -> throw exception var n_windowInfo = windowInfo.ToNative(); var n_client = client.ToNative(); var n_settings = settings.ToNative(); var n_requestContext = requestContext != null?requestContext.ToNative() : null; fixed(char *url_ptr = url) { cef_string_t n_url = new cef_string_t(url_ptr, url != null ? url.Length : 0); var n_browser = cef_browser_host_t.create_browser_sync(n_windowInfo, n_client, &n_url, n_settings, n_requestContext); return(CefBrowser.FromNative(n_browser)); } // TODO: free n_ structs ? }
/// <summary> /// Returns true if this object is pointing to the same context as |that| /// object. /// </summary> public bool IsSame(CefRequestContext other) { if (other == null) { return(false); } return(cef_request_context_t.is_same(_self, other.ToNative()) != 0); }
/// <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. If |request_context| is empty the /// global request context will be used. This method can be called on any /// browser process thread and will not block. /// </summary> public static void CreateBrowser(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, string url, CefRequestContext requestContext) { if (windowInfo == null) throw new ArgumentNullException("windowInfo"); if (client == null) throw new ArgumentNullException("client"); if (settings == null) throw new ArgumentNullException("settings"); // TODO: [ApiUsage] if windowInfo.WindowRenderingDisabled && client doesn't provide RenderHandler implementation -> throw exception var n_windowInfo = windowInfo.ToNative(); var n_client = client.ToNative(); var n_settings = settings.ToNative(); var n_requestContext = requestContext != null ? requestContext.ToNative() : null; fixed (char* url_ptr = url) { cef_string_t n_url = new cef_string_t(url_ptr, url != null ? url.Length : 0); var n_success = cef_browser_host_t.create_browser(n_windowInfo, n_client, &n_url, n_settings, n_requestContext); if (n_success != 1) throw ExceptionBuilder.FailedToCreateBrowser(); } // TODO: free n_ structs ? }
/// <summary> /// Returns true if this object is pointing to the same context as |that| /// object. /// </summary> public bool IsSame(CefRequestContext other) { if (other == null) return false; return cef_request_context_t.is_same(_self, other.ToNative()) != 0; }