private void CheckSelf(cef_load_handler_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
private void on_render_process_terminated(cef_load_handler_t *self, cef_browser_t *browser, CefTerminationStatus status) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); OnRenderProcessTerminated(m_browser, status); }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_load_handler_t.Free(_self); _self = null; } }
private void on_loading_state_change(cef_load_handler_t *self, cef_browser_t *browser, int isLoading, int canGoBack, int canGoForward) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); OnLoadingStateChange(mBrowser, isLoading != 0, canGoBack != 0, canGoForward != 0); }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_load_handler_t.Free(_self); _self = null; } }
private void on_plugin_crashed(cef_load_handler_t *self, cef_browser_t *browser, cef_string_t *plugin_path) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); var m_plugin_path = cef_string_t.ToString(plugin_path); OnPluginCrashed(m_browser, m_plugin_path); }
/// <summary> /// Called when the browser is done loading a frame. The |frame| value /// will never be empty -- call the IsMain() method to check if this /// frame is the main frame. Multiple frames may be loading at the same /// time. Sub-frames may start or continue loading after the main frame /// load has ended. This method will always be called for all frames /// irrespective of whether the request completes successfully. /// </summary> private void on_load_end(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, int httpStatusCode) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_frame = CefFrame.From(frame); this.OnLoadEnd(m_browser, m_frame, httpStatusCode); }
/// <summary> /// Called when the browser begins loading a frame. The |frame| value /// will never be empty -- call the IsMain() method to check if this /// frame is the main frame. Multiple frames may be loading at the same /// time. Sub-frames may start or continue loading after the main frame /// load has ended. This method may not be called for a particular frame /// if the load request for that frame fails. /// </summary> private void on_load_start(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_frame = CefFrame.From(frame); this.OnLoadStart(m_browser, m_frame); }
public CefLoadHandler() { cef_load_handler_t *self = this.NativeInstance; self->on_loading_state_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadingStateChange); self->on_load_start = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadStart); self->on_load_end = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadEnd); self->on_load_error = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadError); }
private void on_load_start(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); var m_frame = CefFrame.FromNative(frame); OnLoadStart(m_browser, m_frame); }
private void on_load_end(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, int httpStatusCode) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); var m_frame = CefFrame.FromNative(frame); OnLoadEnd(m_browser, m_frame, httpStatusCode); }
private static unsafe void OnLoadingStateChangeImpl(cef_load_handler_t *self, cef_browser_t *browser, int isLoading, int canGoBack, int canGoForward) { var instance = GetInstance((IntPtr)self) as CefLoadHandler; if (instance == null || ((ICefLoadHandlerPrivate)instance).AvoidOnLoadingStateChange()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); return; } instance.OnLoadingStateChange(CefBrowser.Wrap(CefBrowser.Create, browser), isLoading != 0, canGoBack != 0, canGoForward != 0); }
private void on_load_error(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, CefErrorCode errorCode, cef_string_t *errorText, cef_string_t *failedUrl) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); var m_frame = CefFrame.FromNative(frame); var m_errorText = cef_string_t.ToString(errorText); var m_failedUrl = cef_string_t.ToString(failedUrl); OnLoadError(m_browser, m_frame, errorCode, m_errorText, m_failedUrl); }
private void add_ref(cef_load_handler_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
private int release(cef_load_handler_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } } return(result); } }
private static unsafe void OnLoadStartImpl(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, CefTransitionType transition_type) { var instance = GetInstance((IntPtr)self) as CefLoadHandler; if (instance == null || ((ICefLoadHandlerPrivate)instance).AvoidOnLoadStart()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); ReleaseIfNonNull((cef_base_ref_counted_t *)frame); return; } instance.OnLoadStart(CefBrowser.Wrap(CefBrowser.Create, browser), CefFrame.Wrap(CefFrame.Create, frame), transition_type); }
private static unsafe void OnLoadEndImpl(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, int httpStatusCode) { var instance = GetInstance((IntPtr)self) as CefLoadHandler; if (instance == null || ((ICefLoadHandlerPrivate)instance).AvoidOnLoadEnd()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); ReleaseIfNonNull((cef_base_ref_counted_t *)frame); return; } instance.OnLoadEnd(CefBrowser.Wrap(CefBrowser.Create, browser), CefFrame.Wrap(CefFrame.Create, frame), httpStatusCode); }
private static unsafe void OnLoadErrorImpl(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, CefErrorCode errorCode, cef_string_t *errorText, cef_string_t *failedUrl) { var instance = GetInstance((IntPtr)self) as CefLoadHandler; if (instance == null || ((ICefLoadHandlerPrivate)instance).AvoidOnLoadError()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); ReleaseIfNonNull((cef_base_ref_counted_t *)frame); return; } instance.OnLoadError(CefBrowser.Wrap(CefBrowser.Create, browser), CefFrame.Wrap(CefFrame.Create, frame), errorCode, CefString.Read(errorText), CefString.Read(failedUrl)); }
public CefLoadHandler() { cef_load_handler_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_loading_state_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadingStateChange); self->on_load_start = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadStart); self->on_load_end = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadEnd); self->on_load_error = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadError); #else self->on_loading_state_change = (delegate * unmanaged[Stdcall] < cef_load_handler_t *, cef_browser_t *, int, int, int, void >) & OnLoadingStateChangeImpl; self->on_load_start = (delegate * unmanaged[Stdcall] < cef_load_handler_t *, cef_browser_t *, cef_frame_t *, CefTransitionType, void >) & OnLoadStartImpl; self->on_load_end = (delegate * unmanaged[Stdcall] < cef_load_handler_t *, cef_browser_t *, cef_frame_t *, int, void >) & OnLoadEndImpl; self->on_load_error = (delegate * unmanaged[Stdcall] < cef_load_handler_t *, cef_browser_t *, cef_frame_t *, CefErrorCode, cef_string_t *, cef_string_t *, void >) & OnLoadErrorImpl; #endif }
/// <summary> /// Called when the browser fails to load a resource. |errorCode| is the /// error code number and |failedUrl| is the URL that failed to load. To /// provide custom error text assign the text to |errorText| and return /// true. Otherwise, return false for the default error text. See /// net\base\net_error_list.h for complete descriptions of the error /// codes. /// </summary> private int on_load_error(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_handler_errorcode_t errorCode, /*const*/ cef_string_t *failedUrl, cef_string_t *errorText) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_frame = CefFrame.From(frame); var m_failedUrl = cef_string_t.ToString(failedUrl); var m_errorText = cef_string_t.ToString(errorText); var c_errorText = m_errorText; var result = this.OnLoadError(m_browser, m_frame, (CefHandlerErrorCode)errorCode, m_failedUrl, ref m_errorText) ? 1 : 0; if ((object)c_errorText != (object)m_errorText) { cef_string_t.Copy(m_errorText, errorText); } return(result); }
protected CefLoadHandler() { _self = cef_load_handler_t.Alloc(); _ds0 = new cef_load_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_load_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_load_handler_t.get_refct_delegate(get_refct); _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_load_handler_t.on_loading_state_change_delegate(on_loading_state_change); _self->_on_loading_state_change = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_load_handler_t.on_load_start_delegate(on_load_start); _self->_on_load_start = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_load_handler_t.on_load_end_delegate(on_load_end); _self->_on_load_end = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_load_handler_t.on_load_error_delegate(on_load_error); _self->_on_load_error = Marshal.GetFunctionPointerForDelegate(_ds6); }
protected CefLoadHandler() { _self = cef_load_handler_t.Alloc(); _ds0 = new cef_load_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_load_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_load_handler_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_load_handler_t.on_loading_state_change_delegate(on_loading_state_change); _self->_on_loading_state_change = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_load_handler_t.on_load_start_delegate(on_load_start); _self->_on_load_start = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_load_handler_t.on_load_end_delegate(on_load_end); _self->_on_load_end = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_load_handler_t.on_load_error_delegate(on_load_error); _self->_on_load_error = Marshal.GetFunctionPointerForDelegate(_ds6); }
protected CefLoadHandler() { _self = cef_load_handler_t.Alloc(); _ds0 = new cef_load_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_load_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_load_handler_t.get_refct_delegate(get_refct); _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_load_handler_t.on_load_start_delegate(on_load_start); _self->_on_load_start = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_load_handler_t.on_load_end_delegate(on_load_end); _self->_on_load_end = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_load_handler_t.on_load_error_delegate(on_load_error); _self->_on_load_error = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_load_handler_t.on_render_process_terminated_delegate(on_render_process_terminated); _self->_on_render_process_terminated = Marshal.GetFunctionPointerForDelegate(_ds6); _ds7 = new cef_load_handler_t.on_plugin_crashed_delegate(on_plugin_crashed); _self->_on_plugin_crashed = Marshal.GetFunctionPointerForDelegate(_ds7); }
/// <summary> /// Called when the browser is done loading a frame. The |frame| value will /// never be empty -- call the IsMain() method to check if this frame is the /// main frame. Multiple frames may be loading at the same time. Sub-frames may /// start or continue loading after the main frame load has ended. This method /// will always be called for all frames irrespective of whether the request /// completes successfully. /// </summary> // protected abstract void OnLoadEnd(cef_browser_t* browser, cef_frame_t* frame, int httpStatusCode); private void on_load_error(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, CefErrorCode errorCode, cef_string_t *errorText, cef_string_t *failedUrl) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefLoadHandler.OnLoadError }
private int has_one_ref(cef_load_handler_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }
/// <summary> /// Called when the loading state has changed. This callback will be executed /// twice -- once when loading is initiated either programmatically or by user /// action, and once when loading is terminated due to completion, cancellation /// of failure. /// </summary> // protected abstract void OnLoadingStateChange(cef_browser_t* browser, int isLoading, int canGoBack, int canGoForward); private void on_load_start(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefLoadHandler.OnLoadStart }
/// <summary> /// Called when the browser begins loading a frame. The |frame| value will /// never be empty -- call the IsMain() method to check if this frame is the /// main frame. Multiple frames may be loading at the same time. Sub-frames may /// start or continue loading after the main frame load has ended. This method /// may not be called for a particular frame if the load request for that frame /// fails. For notification of overall browser load status use /// OnLoadingStateChange instead. /// </summary> // protected abstract void OnLoadStart(cef_browser_t* browser, cef_frame_t* frame); private void on_load_end(cef_load_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, int httpStatusCode) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefLoadHandler.OnLoadEnd }
private int get_refct(cef_load_handler_t *self) { return(_refct); }
public CefLoadHandler(cef_load_handler_t *instance) : base((cef_base_ref_counted_t *)instance) { }
private int has_at_least_one_ref(cef_load_handler_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
internal static void Free(cef_load_handler_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
private void on_loading_state_change(cef_load_handler_t *self, cef_browser_t *browser, int isLoading, int canGoBack, int canGoForward) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefLoadHandler.OnLoadingStateChange }