Esempio n. 1
0
        private void on_resource_load_complete(cef_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.FromNative(browser);
            var mFrame    = CefFrame.FromNative(frame);
            var mRequest  = CefRequest.FromNative(request);
            var mResponse = CefResponse.FromNative(response);

            OnResourceLoadComplete(mBrowser, mFrame, mRequest, mResponse, status, received_content_length);
        }
Esempio n. 2
0
        private int on_resource_response(cef_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.FromNative(browser);
            var m_frame    = CefFrame.FromNative(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);
        }
        private void get_response_headers(cef_resource_handler_t *self, cef_response_t *response, long *response_length, cef_string_t *redirectUrl)
        {
            CheckSelf(self);

            var    m_response = CefResponse.FromNative(response);
            long   m_responseLength;
            string m_redirectUrl;

            GetResponseHeaders(m_response, out m_responseLength, out m_redirectUrl);

            *response_length = m_responseLength;

            if (!string.IsNullOrEmpty(m_redirectUrl))
            {
                cef_string_t.Copy(m_redirectUrl, redirectUrl);
            }
        }
Esempio n. 4
0
        private cef_response_filter_t *get_resource_response_filter(cef_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.FromNative(browser);
            var mFrame    = CefFrame.FromNative(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);
        }
 /// <summary>
 /// Create a new CefResponse object.
 /// </summary>
 public static CefResponse Create()
 {
     return(CefResponse.FromNative(
                cef_response_t.create()
                ));
 }
 /// <summary>
 /// Retrieve response header information. If the response length is not known
 /// set |response_length| to -1 and ReadResponse() will be called until it
 /// returns false. If the response length is known set |response_length|
 /// to a positive value and ReadResponse() will be called until it returns
 /// false or the specified number of bytes have been read. Use the |response|
 /// object to set the mime type, http status code and other optional header
 /// values. To redirect the request to a new URL set |redirectUrl| to the new
 /// URL.
 /// </summary>
 protected abstract void GetResponseHeaders(CefResponse response, out long responseLength, out string redirectUrl);
 /// <summary>
 /// Returns the response, or NULL if no response information is available.
 /// Response information will only be available after the upload has completed.
 /// The returned object is read-only and should not be modified.
 /// </summary>
 public CefResponse GetResponse()
 {
     return(CefResponse.FromNativeOrNull(
                cef_urlrequest_t.get_response(_self)
                ));
 }
Esempio n. 8
0
 /// <summary>
 /// Called on the IO thread when a resource load has completed. |request| and
 /// |response| represent the request and response respectively and cannot be
 /// modified in this callback. |status| indicates the load completion status.
 /// |received_content_length| is the number of response bytes actually read.
 /// </summary>
 protected virtual void OnResourceLoadComplete(CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response, CefUrlRequestStatus status, long receivedContentLength)
 {
 }
Esempio n. 9
0
 /// <summary>
 /// Called on the IO thread to optionally filter resource response content.
 /// |request| and |response| represent the request and response respectively
 /// and cannot be modified in this callback.
 /// </summary>
 protected virtual CefResponseFilter GetResourceResponseFilter(CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response)
 {
     return(null);
 }
Esempio n. 10
0
 /// <summary>
 /// Called on the IO thread when a resource response is received. To allow the
 /// resource to load normally return false. To redirect or retry the resource
 /// modify |request| (url, headers or post body) and return true. The
 /// |response| object cannot be modified in this callback.
 /// </summary>
 protected virtual bool OnResourceResponse(CefBrowser browser, CefFrame frame, CefRequest request, CefResponse response)
 {
     return(false);
 }