示例#1
0
        private int on_before_browser(cef_extension_handler_t *self, cef_extension_t *extension, cef_browser_t *browser, cef_browser_t *active_browser, int index, cef_string_t *url, int active, cef_window_info_t *windowInfo, cef_client_t **client, cef_browser_settings_t *settings)
        {
            CheckSelf(self);

            var m_extension     = CefExtension.FromNative(extension);
            var m_browser       = CefBrowser.FromNativeOrNull(browser);
            var m_activeBrowser = CefBrowser.FromNativeOrNull(active_browser);
            var m_url           = cef_string_t.ToString(url);
            var m_active        = active != 0;
            var m_windowInfo    = CefWindowInfo.FromNative(windowInfo);
            var m_client        = CefClient.FromNative(*client);
            var m_settings      = new CefBrowserSettings(settings);

            var o_client = m_client;
            var cancel   = OnBeforeBrowser(m_extension, m_browser, m_activeBrowser, index, m_url, m_active, m_windowInfo, ref m_client, m_settings);

            if (!cancel && ((object)o_client != m_client && m_client != null))
            {
                *client = m_client.ToNative();
            }

            m_windowInfo.Dispose();
            m_settings.Dispose();

            return(cancel ? 1 : 0);
        }
示例#2
0
        private void on_resource_load_complete(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_response_t *response, CefUrlRequestStatus status, long received_content_length)
        {
            CheckSelf(self);

            var mBrowser  = CefBrowser.FromNativeOrNull(browser);
            var mFrame    = CefFrame.FromNativeOrNull(frame);
            var mRequest  = CefRequest.FromNative(request);
            var mResponse = CefResponse.FromNative(response);

            OnResourceLoadComplete(mBrowser, mFrame, mRequest, mResponse, status, received_content_length);
        }
示例#3
0
        private cef_cookie_access_filter_t *get_cookie_access_filter(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNativeOrNull(browser);
            var m_frame   = CefFrame.FromNativeOrNull(frame);
            var m_request = CefRequest.FromNative(request);

            var m_result = GetCookieAccessFilter(m_browser, m_frame, m_request);

            return(m_result != null?m_result.ToNative() : null);
        }
        private int can_send_cookie(cef_cookie_access_filter_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_cookie_t *cookie)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNativeOrNull(browser);
            var m_frame   = CefFrame.FromNativeOrNull(frame);
            var m_request = CefRequest.FromNative(request);
            var m_cookie  = CefCookie.FromNative(cookie);

            var m_result = CanSendCookie(m_browser, m_frame, m_request, m_cookie);

            return(m_result ? 1 : 0);
        }
示例#5
0
        private int can_access_browser(cef_extension_handler_t *self, cef_extension_t *extension, cef_browser_t *browser, int include_incognito, cef_browser_t *target_browser)
        {
            CheckSelf(self);

            var m_extension       = CefExtension.FromNative(extension);
            var m_browser         = CefBrowser.FromNativeOrNull(browser);
            var m_includeIcognito = include_incognito != 0;
            var m_targetBrowser   = CefBrowser.FromNativeOrNull(target_browser);

            var result = CanAccessBrowser(m_extension, m_browser, m_includeIcognito, m_targetBrowser);

            return(result ? 1 : 0);
        }
示例#6
0
        private void on_protocol_execution(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, int *allow_os_execution)
        {
            CheckSelf(self);

            var m_browser            = CefBrowser.FromNativeOrNull(browser);
            var m_frame              = CefFrame.FromNativeOrNull(frame);
            var m_request            = CefRequest.FromNative(request);
            var m_allow_os_execution = *allow_os_execution != 0;

            OnProtocolExecution(m_browser, m_frame, m_request, ref m_allow_os_execution);

            *allow_os_execution = m_allow_os_execution ? 1 : 0;
        }
示例#7
0
        private int on_resource_response(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_response_t *response)
        {
            CheckSelf(self);

            var m_browser  = CefBrowser.FromNativeOrNull(browser);
            var m_frame    = CefFrame.FromNativeOrNull(frame);
            var m_request  = CefRequest.FromNative(request);
            var m_response = CefResponse.FromNative(response);

            var m_result = OnResourceResponse(m_browser, m_frame, m_request, m_response);

            return(m_result ? 1 : 0);
        }
示例#8
0
        private cef_resource_handler_t *create(cef_scheme_handler_factory_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_string_t *scheme_name, cef_request_t *request)
        {
            CheckSelf(self);

            var m_browser    = CefBrowser.FromNativeOrNull(browser);
            var m_frame      = CefFrame.FromNativeOrNull(frame);
            var m_schemeName = cef_string_t.ToString(scheme_name);
            var m_request    = CefRequest.FromNative(request);

            var handler = Create(m_browser, m_frame, m_schemeName, m_request);

            // TODO: [ApiUsage] method can return null, only when schemeName is built-in scheme, in other cases it is incorrect.
            return(handler != null?handler.ToNative() : null);
        }
示例#9
0
        private cef_resource_handler_t *get_resource_handler(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNativeOrNull(browser);
            var m_frame   = CefFrame.FromNativeOrNull(frame);
            var m_request = CefRequest.FromNative(request);

            var handler = GetResourceHandler(m_browser, m_frame, m_request);

            m_request.Dispose();

            return(handler != null?handler.ToNative() : null);
        }
示例#10
0
        private cef_size_t get_pdf_paper_size(cef_print_handler_t *self, cef_browser_t *browser, int device_units_per_inch)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNativeOrNull(browser);

            var m_result = GetPdfPaperSize(mBrowser, device_units_per_inch);

            var n_result = new cef_size_t
            {
                width  = m_result.Width,
                height = m_result.Height,
            };

            return(n_result);
        }
        private cef_resource_request_handler_t *get_resource_request_handler(cef_request_context_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, int is_navigation, int is_download, cef_string_t *request_initiator, int *disable_default_handling)
        {
            CheckSelf(self);

            var m_browser                = CefBrowser.FromNativeOrNull(browser);
            var m_frame                  = CefFrame.FromNativeOrNull(frame);
            var m_request                = CefRequest.FromNative(request);
            var m_isNavigation           = is_navigation != 0;
            var m_isDownload             = is_download != 0;
            var m_requestInitiator       = cef_string_t.ToString(request_initiator);
            var m_disableDefaultHandling = *disable_default_handling != 0;

            var m_result = GetResourceRequestHandler(m_browser, m_frame, m_request, m_isNavigation, m_isDownload, m_requestInitiator, ref m_disableDefaultHandling);

            *disable_default_handling = m_disableDefaultHandling ? 1 : 0;

            return(m_result != null?m_result.ToNative() : null);
        }
示例#12
0
        private int get_extension_resource(cef_extension_handler_t *self, cef_extension_t *extension, cef_browser_t *browser, cef_string_t *file, cef_get_extension_resource_callback_t *callback)
        {
            CheckSelf(self);

            var m_extension = CefExtension.FromNative(extension);
            var m_browser   = CefBrowser.FromNativeOrNull(browser);
            var m_file      = cef_string_t.ToString(file);
            var m_callback  = CefGetExtensionResourceCallback.FromNativeOrNull(callback);

            var handled = GetExtensionResource(m_extension, m_browser, m_file, m_callback);

            if (!handled)
            {
                m_callback.Dispose();
            }

            return(handled ? 1 : 0);
        }
示例#13
0
        private cef_response_filter_t *get_resource_response_filter(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_response_t *response)
        {
            CheckSelf(self);

            var mBrowser  = CefBrowser.FromNativeOrNull(browser);
            var mFrame    = CefFrame.FromNativeOrNull(frame);
            var mRequest  = CefRequest.FromNative(request);
            var mResponse = CefResponse.FromNative(response);

            var result = GetResourceResponseFilter(mBrowser, mFrame, mRequest, mResponse);

            if (result != null)
            {
                return(result.ToNative());
            }

            return(null);
        }
示例#14
0
        private void on_resource_redirect(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_response_t *response, cef_string_t *new_url)
        {
            CheckSelf(self);

            var m_browser  = CefBrowser.FromNativeOrNull(browser);
            var m_frame    = CefFrame.FromNativeOrNull(frame);
            var m_request  = CefRequest.FromNative(request);
            var m_response = CefResponse.FromNative(response);
            var m_newUrl   = cef_string_t.ToString(new_url);

            var o_newUrl = m_newUrl;

            OnResourceRedirect(m_browser, m_frame, m_request, m_response, ref m_newUrl);

            if ((object)m_newUrl != (object)o_newUrl)
            {
                cef_string_t.Copy(m_newUrl, new_url);
            }
        }
示例#15
0
        private CefReturnValue on_before_resource_load(cef_resource_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_callback_t *callback)
        {
            CheckSelf(self);

            var m_browser  = CefBrowser.FromNativeOrNull(browser);
            var m_frame    = CefFrame.FromNativeOrNull(frame);
            var m_request  = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

            var result = OnBeforeResourceLoad(m_browser, m_frame, m_request, m_callback);

            if (result != CefReturnValue.ContinueAsync)
            {
                m_browser.Dispose();
                m_frame.Dispose();
                m_request.Dispose();
                m_callback.Dispose();
            }

            return(result);
        }
示例#16
0
 /// <summary>
 /// Returns the browser for this context. This method will return an empty
 /// reference for WebWorker contexts.
 /// </summary>
 public CefBrowser GetBrowser()
 {
     return(CefBrowser.FromNativeOrNull(
                cef_v8context_t.get_browser(_self)
                ));
 }