示例#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 ?
        }
示例#2
0
        /// <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);
        }
示例#3
0
 /// <summary>
 /// Creates a new context object that shares storage with |other| and uses an
 /// optional |handler|.
 /// </summary>
 public static CefRequestContext CreateContext(CefRequestContext other, CefRequestContextHandler handler)
 {
     return(CefRequestContext.FromNative(
                cef_request_context_t.create_context(
                    other.ToNative(),
                    handler != null ? handler.ToNative() : null
                    )
                ));
 }
        /// <summary>
        /// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request
        /// methods are supported. Multiple post data elements are not supported and
        /// elements of type PDE_TYPE_FILE are only supported for requests originating
        /// from the browser process. Requests originating from the render process will
        /// receive the same handling as requests originating from Web content -- if
        /// the response contains Content-Disposition or Mime-Type header values that
        /// would not normally be rendered then the response may receive special
        /// handling inside the browser (for example, via the file download code path
        /// instead of the URL request code path). The |request| object will be marked
        /// as read-only after calling this method. In the browser process if
        /// |request_context| is empty the global request context will be used. In the
        /// render process |request_context| must be empty and the context associated
        /// with the current renderer process' browser will be used.
        /// </summary>
        public static CefUrlRequest Create(CefRequest request, CefUrlRequestClient client, CefRequestContext requestContext)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            var n_request        = request.ToNative();
            var n_client         = client.ToNative();
            var n_requestContext = requestContext != null?requestContext.ToNative() : null;

            return(CefUrlRequest.FromNative(
                       cef_urlrequest_t.create(n_request, n_client, n_requestContext)
                       ));
        }
示例#5
0
 /// <summary>
 /// Returns true if this object is sharing the same storage as |that| object.
 /// </summary>
 public bool IsSharingWith(CefRequestContext other)
 {
     return(cef_request_context_t.is_sharing_with(_self, other.ToNative()) != 0);
 }