Ejemplo n.º 1
0
        private void on_main_frame_changed(cef_frame_handler_t *self, cef_browser_t *browser, cef_frame_t *old_frame, cef_frame_t *new_frame)
        {
            CheckSelf(self);

            var mBrowser  = CefBrowser.FromNative(browser);
            var mOldFrame = CefFrame.FromNativeOrNull(old_frame);
            var mNewFrame = CefFrame.FromNativeOrNull(new_frame);

            OnMainFrameChanged(mBrowser, mOldFrame, mNewFrame);
        }
Ejemplo n.º 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);
        }
        /// <summary>
        /// Returns the frame with the specified name, or NULL if not found.
        /// </summary>
        public CefFrame GetFrame(string name)
        {
            fixed(char *name_str = name)
            {
                var n_name = new cef_string_t(name_str, name.Length);

                return(CefFrame.FromNativeOrNull(
                           cef_browser_t.get_frame(_self, &n_name)
                           ));
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
        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);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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);
            }
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Returns the main (top-level) frame for the browser. In the browser process
 /// this will return a valid object until after
 /// CefLifeSpanHandler::OnBeforeClose is called. In the renderer process this
 /// will return NULL if the main frame is hosted in a different renderer
 /// process (e.g. for cross-origin sub-frames). The main frame object will
 /// change during cross-origin navigation or re-navigation after renderer
 /// process termination (due to crashes, etc).
 /// </summary>
 public CefFrame GetMainFrame()
 {
     return(CefFrame.FromNativeOrNull(
                cef_browser_t.get_main_frame(_self)
                ));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Returns the frame for this context. This method will return an empty
 /// reference for WebWorker contexts.
 /// </summary>
 public CefFrame GetFrame()
 {
     return(CefFrame.FromNativeOrNull(
                cef_v8context_t.get_frame(_self)
                ));
 }
 /// <summary>
 /// Returns the frame with the specified identifier, or NULL if not found.
 /// </summary>
 public CefFrame GetFrame(long identifier)
 {
     return(CefFrame.FromNativeOrNull(
                cef_browser_t.get_frame_byident(_self, identifier)
                ));
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Returns the focused frame for the browser window.
 /// </summary>
 public CefFrame GetFocusedFrame()
 {
     return(CefFrame.FromNativeOrNull(
                cef_browser_t.get_focused_frame(_self)
                ));
 }