/// <summary> /// Read response data. If data is available immediately copy up to /// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number /// of bytes copied, and return true. To read the data at a later time /// set |bytes_read| to 0, return true and call BytesAvailable() when the /// data is available. To indicate response completion return false. /// </summary> private int read_response(cef_scheme_handler_t *self, void *data_out, int bytes_to_read, int *bytes_read, cef_scheme_handler_callback_t *callback) { ThrowIfObjectDisposed(); var mCallback = CefSchemeHandlerCallback.From(callback); using (var mStream = new UnmanagedMemoryStream((byte *)data_out, bytes_to_read, bytes_to_read, FileAccess.Write)) { int mBytesRead; var handled = this.ReadResponse(mStream, bytes_to_read, out mBytesRead, mCallback); * bytes_read = mBytesRead; return(handled ? 1 : 0); } }
/// <summary> /// Begin processing the request. To handle the request return true and /// call HeadersAvailable() once the response header information is /// available (HeadersAvailable() can also be called from inside this /// method if header information is available immediately). To cancel the request return false. /// </summary> private int process_request(cef_scheme_handler_t *self, cef_request_t *request, cef_scheme_handler_callback_t *callback) { ThrowIfObjectDisposed(); var mRequest = CefRequest.From(request); var mCallback = CefSchemeHandlerCallback.From(callback); var handled = this.ProcessRequest(mRequest, mCallback); return(handled ? 1 : 0); }