/// <summary> /// Returns the frame with the specified name, or NULL if not found. /// </summary> public unsafe virtual CefFrame GetFrame(string name) { fixed(char *s0 = name) { var cstr0 = new cef_string_t { Str = s0, Length = name != null ? name.Length : 0 }; return(SafeCall(CefFrame.Wrap(CefFrame.Create, NativeInstance->GetFrame(&cstr0)))); } }
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)); }
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 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); }
// void (*)(_cef_display_handler_t* self, _cef_browser_t* browser, _cef_frame_t* frame, const cef_string_t* url)* private static unsafe void OnAddressChangeImpl(cef_display_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_string_t *url) { var instance = GetInstance((IntPtr)self) as CefDisplayHandler; if (instance == null || ((ICefDisplayHandlerPrivate)instance).AvoidOnAddressChange()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); ReleaseIfNonNull((cef_base_ref_counted_t *)frame); return; } instance.OnAddressChange(CefBrowser.Wrap(CefBrowser.Create, browser), CefFrame.Wrap(CefFrame.Create, frame), CefString.Read(url)); }
private static unsafe void OnFrameDetachedImpl(cef_frame_handler_t *self, cef_browser_t *browser, cef_frame_t *frame) { var instance = GetInstance((IntPtr)self) as CefFrameHandler; if (instance == null || ((ICefFrameHandlerPrivate)instance).AvoidOnFrameDetached()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); ReleaseIfNonNull((cef_base_ref_counted_t *)frame); return; } instance.OnFrameDetached(CefBrowser.Wrap(CefBrowser.Create, browser), CefFrame.Wrap(CefFrame.Create, frame)); }
/// <summary> /// Returns the direct sub-frames of the current frame. /// </summary> /// <returns>The direct sub-frames of the current frame.</returns> public unsafe CefFrame[] GetFrames() { long frameid = this.Identifier; CefBrowser browser = this.Browser; if (browser is null) { #if NET45 return(new CefFrame[0]); #else return(Array.Empty <CefFrame>()); #endif } long[] ids = browser.GetFrameIdentifiers(); var frames = new List <CefFrame>(ids.Length); foreach (long fid in ids) { cef_frame_t *frame = browser.NativeInstance->GetFrameByIdent(fid); if (frame == null) { continue; } cef_frame_t *parent = frame->GetParent(); if (parent != null) { long parentid = parent->GetIdentifier(); ((cef_base_ref_counted_t *)parent)->Release(); if (parentid == frameid) { frames.Add(CefFrame.Wrap <CefFrame>(f => new CefFrame((cef_frame_t *)f), frame)); continue; } } ((cef_base_ref_counted_t *)frame)->Release(); } GC.KeepAlive(browser); return(frames.ToArray()); }
/// <summary> /// Returns the frame with the specified identifier, or NULL if not found. /// </summary> public unsafe virtual CefFrame GetFrameByIdent(long identifier) { return(SafeCall(CefFrame.Wrap(CefFrame.Create, NativeInstance->GetFrameByIdent(identifier)))); }
// void (*)(_cef_context_menu_handler_t* self, _cef_browser_t* browser, _cef_frame_t* frame, _cef_context_menu_params_t* params, _cef_menu_model_t* model)* private static unsafe void OnBeforeContextMenuImpl(cef_context_menu_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, cef_menu_model_t *model) { var instance = GetInstance((IntPtr)self) as CefContextMenuHandler; if (instance == null || ((ICefContextMenuHandlerPrivate)instance).AvoidOnBeforeContextMenu()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); ReleaseIfNonNull((cef_base_ref_counted_t *)frame); ReleaseIfNonNull((cef_base_ref_counted_t *)@params); ReleaseIfNonNull((cef_base_ref_counted_t *)model); return; } instance.OnBeforeContextMenu(CefBrowser.Wrap(CefBrowser.Create, browser), CefFrame.Wrap(CefFrame.Create, frame), CefContextMenuParams.Wrap(CefContextMenuParams.Create, @params), CefMenuModel.Wrap(CefMenuModel.Create, model)); }