public unsafe cef_urlrequest_t *CreateUrlRequest(cef_request_t *request, cef_urlrequest_client_t *client) { fixed(cef_frame_t *self = &this) { return(((delegate * unmanaged[Stdcall] < cef_frame_t *, cef_request_t *, cef_urlrequest_client_t *, cef_urlrequest_t * >)create_urlrequest)(self, request, client)); } }
private void CheckSelf(cef_urlrequest_client_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_urlrequest_client_t.Free(_self); _self = null; } }
private void on_download_progress(cef_urlrequest_client_t *self, cef_urlrequest_t *request, long current, long total) { CheckSelf(self); var m_request = CefUrlRequest.FromNative(request); OnDownloadProgress(m_request, current, total); }
private void on_request_complete(cef_urlrequest_client_t *self, cef_urlrequest_t *request) { CheckSelf(self); var m_request = CefUrlRequest.FromNative(request); OnRequestComplete(m_request); }
public CefUrlRequestClient() { cef_urlrequest_client_t *self = this.NativeInstance; self->on_request_complete = (void *)Marshal.GetFunctionPointerForDelegate(fnOnRequestComplete); self->on_upload_progress = (void *)Marshal.GetFunctionPointerForDelegate(fnOnUploadProgress); self->on_download_progress = (void *)Marshal.GetFunctionPointerForDelegate(fnOnDownloadProgress); self->on_download_data = (void *)Marshal.GetFunctionPointerForDelegate(fnOnDownloadData); self->get_auth_credentials = (void *)Marshal.GetFunctionPointerForDelegate(fnGetAuthCredentials); }
internal static CefUrlRequestClient FromNative(cef_urlrequest_client_t *ptr) { var value = FromNativeOrNull(ptr); if (value == null) { throw ExceptionBuilder.ObjectNotFound(); } return(value); }
private static unsafe void OnDownloadDataImpl(cef_urlrequest_client_t *self, cef_urlrequest_t *request, void *data, UIntPtr data_length) { var instance = GetInstance((IntPtr)self) as CefUrlRequestClient; if (instance == null || ((ICefUrlRequestClientPrivate)instance).AvoidOnDownloadData()) { ReleaseIfNonNull((cef_base_ref_counted_t *)request); return; } instance.OnDownloadData(CefUrlRequest.Wrap(CefUrlRequest.Create, request), unchecked ((IntPtr)data), (long)data_length); }
private static unsafe void OnDownloadProgressImpl(cef_urlrequest_client_t *self, cef_urlrequest_t *request, long current, long total) { var instance = GetInstance((IntPtr)self) as CefUrlRequestClient; if (instance == null || ((ICefUrlRequestClientPrivate)instance).AvoidOnDownloadProgress()) { ReleaseIfNonNull((cef_base_ref_counted_t *)request); return; } instance.OnDownloadProgress(CefUrlRequest.Wrap(CefUrlRequest.Create, request), current, total); }
private void on_download_data(cef_urlrequest_client_t *self, cef_urlrequest_t *request, void *data, UIntPtr data_length) { CheckSelf(self); var m_request = CefUrlRequest.FromNative(request); using (var stream = new UnmanagedMemoryStream((byte *)data, (long)data_length)) { OnDownloadData(m_request, stream); } }
internal static CefUrlRequestClient FromNativeOrNull(cef_urlrequest_client_t *ptr) { CefUrlRequestClient value = null; bool found; lock (_roots) { found = _roots.TryGetValue((IntPtr)ptr, out value); } return(found ? value : null); }
private static unsafe void OnRequestCompleteImpl(cef_urlrequest_client_t *self, cef_urlrequest_t *request) { var instance = GetInstance((IntPtr)self) as CefUrlRequestClient; if (instance == null || ((ICefUrlRequestClientPrivate)instance).AvoidOnRequestComplete()) { ReleaseIfNonNull((cef_base_ref_counted_t *)request); return; } instance.OnRequestComplete(CefUrlRequest.Wrap(CefUrlRequest.Create, request)); }
private void add_ref(cef_urlrequest_client_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
private int release(cef_urlrequest_client_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } } return(result); } }
private int get_auth_credentials(cef_urlrequest_client_t *self, int isProxy, cef_string_t *host, int port, cef_string_t *realm, cef_string_t *scheme, cef_auth_callback_t *callback) { CheckSelf(self); var m_isProxy = isProxy != 0; var m_host = cef_string_t.ToString(host); var m_realm = cef_string_t.ToString(realm); var m_scheme = cef_string_t.ToString(scheme); var m_callback = CefAuthCallback.FromNative(callback); var m_result = GetAuthCredentials(m_isProxy, m_host, port, m_realm, m_scheme, m_callback); return(m_result ? 1 : 0); }
public CefUrlRequestClient() { cef_urlrequest_client_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_request_complete = (void *)Marshal.GetFunctionPointerForDelegate(fnOnRequestComplete); self->on_upload_progress = (void *)Marshal.GetFunctionPointerForDelegate(fnOnUploadProgress); self->on_download_progress = (void *)Marshal.GetFunctionPointerForDelegate(fnOnDownloadProgress); self->on_download_data = (void *)Marshal.GetFunctionPointerForDelegate(fnOnDownloadData); self->get_auth_credentials = (void *)Marshal.GetFunctionPointerForDelegate(fnGetAuthCredentials); #else self->on_request_complete = (delegate * unmanaged[Stdcall] < cef_urlrequest_client_t *, cef_urlrequest_t *, void >) & OnRequestCompleteImpl; self->on_upload_progress = (delegate * unmanaged[Stdcall] < cef_urlrequest_client_t *, cef_urlrequest_t *, long, long, void >) & OnUploadProgressImpl; self->on_download_progress = (delegate * unmanaged[Stdcall] < cef_urlrequest_client_t *, cef_urlrequest_t *, long, long, void >) & OnDownloadProgressImpl; self->on_download_data = (delegate * unmanaged[Stdcall] < cef_urlrequest_client_t *, cef_urlrequest_t *, void *, UIntPtr, void >) & OnDownloadDataImpl; self->get_auth_credentials = (delegate * unmanaged[Stdcall] < cef_urlrequest_client_t *, int, cef_string_t *, int, cef_string_t *, cef_string_t *, cef_auth_callback_t *, int >) & GetAuthCredentialsImpl; #endif }
protected CefUrlRequestClient() { _self = cef_urlrequest_client_t.Alloc(); _ds0 = new cef_urlrequest_client_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_urlrequest_client_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_urlrequest_client_t.get_refct_delegate(get_refct); _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_urlrequest_client_t.on_request_complete_delegate(on_request_complete); _self->_on_request_complete = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_urlrequest_client_t.on_upload_progress_delegate(on_upload_progress); _self->_on_upload_progress = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_urlrequest_client_t.on_download_progress_delegate(on_download_progress); _self->_on_download_progress = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_urlrequest_client_t.on_download_data_delegate(on_download_data); _self->_on_download_data = Marshal.GetFunctionPointerForDelegate(_ds6); }
private int has_one_ref(cef_urlrequest_client_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }
/// <summary> /// Notifies the client of upload progress. |current| denotes the number of /// bytes sent so far and |total| is the total size of uploading data (or -1 if /// chunked upload is enabled). This method will only be called if the /// UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request. /// </summary> // protected abstract void OnUploadProgress(cef_urlrequest_t* request, long current, long total); private void on_download_progress(cef_urlrequest_client_t *self, cef_urlrequest_t *request, long current, long total) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefUrlRequestClient.OnDownloadProgress }
private void on_request_complete(cef_urlrequest_client_t *self, cef_urlrequest_t *request) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefUrlRequestClient.OnRequestComplete }
private int get_refct(cef_urlrequest_client_t *self) { return(_refct); }
/// <summary> /// Notifies the client of download progress. |current| denotes the number of /// bytes received up to the call and |total| is the expected total size of the /// response (or -1 if not determined). /// </summary> // protected abstract void OnDownloadProgress(cef_urlrequest_t* request, long current, long total); private void on_download_data(cef_urlrequest_client_t *self, cef_urlrequest_t *request, void *data, UIntPtr data_length) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefUrlRequestClient.OnDownloadData }
/// <summary> /// Called when some part of the response is read. |data| contains the current /// bytes received since the last call. This method will not be called if the /// UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request. /// </summary> // protected abstract void OnDownloadData(cef_urlrequest_t* request, void* data, UIntPtr data_length); private int get_auth_credentials(cef_urlrequest_client_t *self, int isProxy, cef_string_t *host, int port, cef_string_t *realm, cef_string_t *scheme, cef_auth_callback_t *callback) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefUrlRequestClient.GetAuthCredentials }
public static cef_urlrequest_t *create_urlrequest(cef_frame_t *self, cef_request_t *request, cef_urlrequest_client_t *client) { create_urlrequest_delegate d; var p = self->_create_urlrequest; if (p == _p1b) { d = _d1b; } else { d = (create_urlrequest_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(create_urlrequest_delegate)); if (_p1b == IntPtr.Zero) { _d1b = d; _p1b = p; } } return(d(self, request, client)); }
public unsafe extern cef_urlrequest_t *CreateUrlRequest(cef_request_t *request, cef_urlrequest_client_t *client);
public CefUrlRequestClient(cef_urlrequest_client_t *instance) : base((cef_base_ref_counted_t *)instance) { }
public static extern cef_urlrequest_t *create(cef_request_t *request, cef_urlrequest_client_t *client, cef_request_context_t *request_context);
internal static void Free(cef_urlrequest_client_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
/// <summary> /// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request /// methods are supported. Multiple post data elements are not supported and /// elements of type PDE_TYPE_FILE are only supported for requests originating /// from the browser process. Requests originating from the render process will /// receive the same handling as requests originating from Web content -- if /// the response contains Content-Disposition or Mime-Type header values that /// would not normally be rendered then the response may receive special /// handling inside the browser (for example, via the file download code path /// instead of the URL request code path). The |request| object will be marked /// as read-only after calling this method. In the browser process if /// |request_context| is empty the global request context will be used. In the /// render process |request_context| must be empty and the context associated /// with the current renderer process' browser will be used. /// </summary> public static cef_urlrequest_t *Create(cef_request_t *request, cef_urlrequest_client_t *client, cef_request_context_t *request_context) { throw new NotImplementedException(); // TODO: CefUrlRequest.Create }