Beispiel #1
0
        /// <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 ?
        }
Beispiel #2
0
        /// <summary>
        /// Open developer tools in its own window. If |inspect_element_at| is non-
        /// empty the element at the specified (x,y) location will be inspected.
        /// </summary>
        public void ShowDevTools(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings browserSettings, CefPoint inspectElementAt)
        {
            var n_inspectElementAt = new cef_point_t(inspectElementAt.X, inspectElementAt.Y);

            cef_browser_host_t.show_dev_tools(_self, windowInfo.ToNative(), client.ToNative(), browserSettings.ToNative(),
                                              &n_inspectElementAt);
        }