Example #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 ?
        }
Example #2
0
 public static void CreateBrowser(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, Uri url, CefRequestContext requestContext)
 {
     CreateBrowser(windowInfo, client, settings, url.ToString(), requestContext);
 }
Example #3
0
 public static CefBrowser CreateBrowserSync(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, CefRequestContext requestContext)
 {
     return CreateBrowserSync(windowInfo, client, settings, string.Empty, requestContext);
 }
Example #4
0
 public static CefBrowser CreateBrowserSync(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, Uri url, CefRequestContext requestContext)
 {
     return CreateBrowserSync(windowInfo, client, settings, url.ToString(), requestContext);
 }
Example #5
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;
        }
Example #6
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;
        }
Example #7
0
 /// <summary>
 /// Returns the global context object.
 /// </summary>
 public static CefRequestContext GetGlobalContext()
 {
     return CefRequestContext.FromNative(
         cef_request_context_t.get_global_context()
         );
 }
 public static CefBrowser CreateBrowserSync(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, CefRequestContext requestContext)
 {
     return(CreateBrowserSync(windowInfo, client, settings, string.Empty, requestContext));
 }
Example #9
0
        /// <summary>
        /// Create a new URL request that is not associated with a specific browser or
        /// frame. Use CefFrame::CreateURLRequest instead if you want the request to
        /// have this association, in which case it may be handled differently (see
        /// documentation on that method). Requests may originate from the both browser
        /// process and the render process.
        /// For requests originating from the browser process:
        /// - It may be intercepted by the client via CefResourceRequestHandler or
        /// CefSchemeHandlerFactory.
        /// - POST data may only contain only a single element of type PDE_TYPE_FILE
        /// or PDE_TYPE_BYTES.
        /// - If |request_context| is empty the global request context will be used.
        /// For requests originating from the render process:
        /// - It cannot be intercepted by the client so only http(s) and blob schemes
        /// are supported.
        /// - POST data may only contain a single element of type PDE_TYPE_BYTES.
        /// - The |request_context| parameter must be NULL.
        /// The |request| object will be marked as read-only after calling this method.
        /// </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 != null?client.ToNative() : null;

            var n_requestContext = requestContext != null?requestContext.ToNative() : null;

            return(CefUrlRequest.FromNative(
                       cef_urlrequest_t.create(n_request, n_client, n_requestContext)
                       ));
        }
Example #10
0
 /// <summary>
 /// Returns the request context that loaded this extension. Will return NULL
 /// for internal extensions or if the extension has been unloaded. See the
 /// CefRequestContext::LoadExtension documentation for more information about
 /// loader contexts. Must be called on the browser process UI thread.
 /// </summary>
 public CefRequestContext GetLoaderContext()
 {
     return(CefRequestContext.FromNativeOrNull(
                cef_extension_t.get_loader_context(_self)
                ));
 }
        /// <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 ?
        }
 public static void CreateBrowser(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, CefRequestContext requestContext)
 {
     CreateBrowser(windowInfo, client, settings, string.Empty, requestContext);
 }
 public static void CreateBrowser(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, Uri url, CefRequestContext requestContext)
 {
     CreateBrowser(windowInfo, client, settings, url.ToString(), requestContext);
 }
 /// <summary>
 /// Returns the request context for this browser.
 /// </summary>
 public CefRequestContext GetRequestContext()
 {
     return(CefRequestContext.FromNative(
                cef_browser_host_t.get_request_context(_self)
                ));
 }
Example #15
0
 public static void CreateBrowser(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, CefRequestContext requestContext)
 {
     CreateBrowser(windowInfo, client, settings, string.Empty, requestContext);
 }
 /// <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);
 }
 public static CefBrowser CreateBrowserSync(CefWindowInfo windowInfo, CefClient client, CefBrowserSettings settings, Uri url, CefRequestContext requestContext)
 {
     return(CreateBrowserSync(windowInfo, client, settings, url.ToString(), requestContext));
 }