public CefDisplayHandler() { cef_display_handler_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_address_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAddressChange); self->on_title_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnTitleChange); self->on_favicon_urlchange = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFaviconUrlChange); self->on_fullscreen_mode_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFullscreenModeChange); self->on_tooltip = (void *)Marshal.GetFunctionPointerForDelegate(fnOnTooltip); self->on_status_message = (void *)Marshal.GetFunctionPointerForDelegate(fnOnStatusMessage); self->on_console_message = (void *)Marshal.GetFunctionPointerForDelegate(fnOnConsoleMessage); self->on_auto_resize = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAutoResize); self->on_loading_progress_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadingProgressChange); self->on_cursor_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnCursorChange); #else self->on_address_change = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, cef_frame_t *, cef_string_t *, void >) & OnAddressChangeImpl; self->on_title_change = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, cef_string_t *, void >) & OnTitleChangeImpl; self->on_favicon_urlchange = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, cef_string_list_t, void >) & OnFaviconUrlChangeImpl; self->on_fullscreen_mode_change = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, int, void >) & OnFullscreenModeChangeImpl; self->on_tooltip = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, cef_string_t *, int >) & OnTooltipImpl; self->on_status_message = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, cef_string_t *, void >) & OnStatusMessageImpl; self->on_console_message = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, CefLogSeverity, cef_string_t *, cef_string_t *, int, int >) & OnConsoleMessageImpl; self->on_auto_resize = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, cef_size_t *, int >) & OnAutoResizeImpl; self->on_loading_progress_change = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, double, void >) & OnLoadingProgressChangeImpl; self->on_cursor_change = (delegate * unmanaged[Stdcall] < cef_display_handler_t *, cef_browser_t *, IntPtr, CefCursorType, cef_cursor_info_t *, int >) & OnCursorChangeImpl; #endif }
private void CheckSelf(cef_display_handler_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
/// <summary> /// Called when the page icon changes. /// </summary> // protected abstract void OnFaviconURLChange(cef_browser_t* browser, cef_string_list* icon_urls); private void on_fullscreen_mode_change(cef_display_handler_t *self, cef_browser_t *browser, int fullscreen) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); OnFullscreenModeChange(mBrowser, fullscreen != 0); }
protected CefDisplayHandler() { _self = cef_display_handler_t.Alloc(); _ds0 = new cef_display_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_display_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_display_handler_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_display_handler_t.has_at_least_one_ref_delegate(has_at_least_one_ref); _self->_base._has_at_least_one_ref = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_display_handler_t.on_address_change_delegate(on_address_change); _self->_on_address_change = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_display_handler_t.on_title_change_delegate(on_title_change); _self->_on_title_change = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_display_handler_t.on_favicon_urlchange_delegate(on_favicon_urlchange); _self->_on_favicon_urlchange = Marshal.GetFunctionPointerForDelegate(_ds6); _ds7 = new cef_display_handler_t.on_fullscreen_mode_change_delegate(on_fullscreen_mode_change); _self->_on_fullscreen_mode_change = Marshal.GetFunctionPointerForDelegate(_ds7); _ds8 = new cef_display_handler_t.on_tooltip_delegate(on_tooltip); _self->_on_tooltip = Marshal.GetFunctionPointerForDelegate(_ds8); _ds9 = new cef_display_handler_t.on_status_message_delegate(on_status_message); _self->_on_status_message = Marshal.GetFunctionPointerForDelegate(_ds9); _dsa = new cef_display_handler_t.on_console_message_delegate(on_console_message); _self->_on_console_message = Marshal.GetFunctionPointerForDelegate(_dsa); _dsb = new cef_display_handler_t.on_auto_resize_delegate(on_auto_resize); _self->_on_auto_resize = Marshal.GetFunctionPointerForDelegate(_dsb); _dsc = new cef_display_handler_t.on_loading_progress_change_delegate(on_loading_progress_change); _self->_on_loading_progress_change = Marshal.GetFunctionPointerForDelegate(_dsc); }
private void on_loading_state_change(cef_display_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_display_handler_t.Free(_self); _self = null; } }
private void on_loading_progress_change(cef_display_handler_t *self, cef_browser_t *browser, double progress) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); OnLoadingProgressChange(mBrowser, progress); }
/// <summary> /// Called when the navigation state has changed. /// </summary> private void on_nav_state_change(cef_display_handler_t *self, cef_browser_t *browser, int canGoBack, int canGoForward) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); this.OnNavStateChange(m_browser, canGoBack != 0, canGoForward != 0); }
/// <summary> /// Called when the Favicon URL for a page changes. /// </summary> private void on_favicon_urlchange(cef_display_handler_t *self, cef_browser_t *browser, cef_string_list *icon_urls) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_icon_urls = CefStringList.From(icon_urls); this.OnFaviconChange(m_browser, m_icon_urls); }
/// <summary> /// Called when the page title changes. /// </summary> private void on_title_change(cef_display_handler_t *self, cef_browser_t *browser, /*const*/ cef_string_t *title) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_title = cef_string_t.ToString(title); this.OnTitleChange(m_browser, m_title); }
/// <summary> /// Called when the size of the content area has changed. /// </summary> private void on_contents_size_change(cef_display_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, int width, int height) { ThrowIfObjectDisposed(); var mBrowser = CefBrowser.From(browser); var mFrame = CefFrame.From(frame); this.OnContentsSizeChange(mBrowser, mFrame, width, height); }
private void on_status_message(cef_display_handler_t *self, cef_browser_t *browser, cef_string_t *value) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mValue = cef_string_t.ToString(value); OnStatusMessage(mBrowser, mValue); }
private void on_title_change(cef_display_handler_t *self, cef_browser_t *browser, cef_string_t *title) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mTitle = cef_string_t.ToString(title); OnTitleChange(mBrowser, mTitle); }
private void on_favicon_urlchange(cef_display_handler_t *self, cef_browser_t *browser, cef_string_list *icon_urls) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mIconUrls = cef_string_list.ToArray(icon_urls); OnFaviconUrlChange(mBrowser, mIconUrls); }
private int on_tooltip(cef_display_handler_t *self, cef_browser_t *browser, cef_string_t *text) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mText = cef_string_t.ToString(text); return(OnTooltip(mBrowser, mText) ? 1 : 0); }
/// <summary> /// Called when a frame's address has changed. /// </summary> private void on_address_change(cef_display_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, /*const*/ cef_string_t *url) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_frame = CefFrame.From(frame); var m_url = cef_string_t.ToString(url); this.OnAddressChange(m_browser, m_frame, m_url); }
private int on_console_message(cef_display_handler_t *self, cef_browser_t *browser, cef_string_t *message, cef_string_t *source, int line) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mMessage = cef_string_t.ToString(message); var mSource = cef_string_t.ToString(source); return(OnConsoleMessage(mBrowser, mMessage, mSource, line) ? 1 : 0); }
private void on_address_change(cef_display_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_string_t *url) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mFrame = CefFrame.FromNative(frame); var mUrl = cef_string_t.ToString(url); OnAddressChange(mBrowser, mFrame, mUrl); }
// void (*)(_cef_display_handler_t* self, _cef_browser_t* browser, int fullscreen)* private static unsafe void OnFullscreenModeChangeImpl(cef_display_handler_t *self, cef_browser_t *browser, int fullscreen) { var instance = GetInstance((IntPtr)self) as CefDisplayHandler; if (instance == null || ((ICefDisplayHandlerPrivate)instance).AvoidOnFullscreenModeChange()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); return; } instance.OnFullscreenModeChange(CefBrowser.Wrap(CefBrowser.Create, browser), fullscreen != 0); }
private void add_ref(cef_display_handler_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
// void (*)(_cef_display_handler_t* self, _cef_browser_t* browser, cef_string_list_t icon_urls)* private static unsafe void OnFaviconUrlChangeImpl(cef_display_handler_t *self, cef_browser_t *browser, cef_string_list_t icon_urls) { var instance = GetInstance((IntPtr)self) as CefDisplayHandler; if (instance == null || ((ICefDisplayHandlerPrivate)instance).AvoidOnFaviconUrlChange()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); return; } instance.OnFaviconUrlChange(CefBrowser.Wrap(CefBrowser.Create, browser), CefStringList.Wrap(icon_urls)); }
/// <summary> /// Called to display a console message. /// Return true to stop the message from being output to the console. /// </summary> private int on_console_message(cef_display_handler_t *self, cef_browser_t *browser, /*const*/ cef_string_t *message, /*const*/ cef_string_t *source, int line) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_message = cef_string_t.ToString(message); var m_source = cef_string_t.ToString(source); var handled = this.OnConsoleMessage(m_browser, m_message, m_source, line); return(handled ? 1 : 0); }
private int release(cef_display_handler_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } } return(result); } }
// 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)); }
public CefDisplayHandler() { cef_display_handler_t *self = this.NativeInstance; self->on_address_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAddressChange); self->on_title_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnTitleChange); self->on_favicon_urlchange = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFaviconUrlChange); self->on_fullscreen_mode_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFullscreenModeChange); self->on_tooltip = (void *)Marshal.GetFunctionPointerForDelegate(fnOnTooltip); self->on_status_message = (void *)Marshal.GetFunctionPointerForDelegate(fnOnStatusMessage); self->on_console_message = (void *)Marshal.GetFunctionPointerForDelegate(fnOnConsoleMessage); self->on_auto_resize = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAutoResize); self->on_loading_progress_change = (void *)Marshal.GetFunctionPointerForDelegate(fnOnLoadingProgressChange); }
/// <summary> /// Called when the browser receives a status message. /// |text| contains the text that will be displayed in the status message and |type| indicates the status message type. /// </summary> private void on_status_message(cef_display_handler_t *self, cef_browser_t *browser, /*const*/ cef_string_t *value, cef_handler_statustype_t type) { ThrowIfObjectDisposed(); // TODO: we can do not expose this event if same message arrived -> no needed creating proxy, but if we do not create proxy we must call releaseref // also this optimization can be done if we store state per-browser, not per-handler // or we can do it per-handler var m_browser = CefBrowser.From(browser); var m_value = cef_string_t.ToString(value); var m_type = (CefHandlerStatusType)type; this.OnStatusMessage(m_browser, m_value, m_type); }
private int on_cursor_change(cef_display_handler_t *self, cef_browser_t *browser, IntPtr cursor, CefCursorType type, cef_cursor_info_t *custom_cursor_info) { CheckSelf(self); var m_browser = CefBrowser.FromNative(browser); var m_cefCursorInfo = type == CefCursorType.Custom ? new CefCursorInfo(custom_cursor_info) : null; var m_result = OnCursorChange(m_browser, cursor, type, m_cefCursorInfo); if (m_cefCursorInfo != null) { m_cefCursorInfo.Dispose(); } return(m_result ? 1 : 0); }
private int on_auto_resize(cef_display_handler_t *self, cef_browser_t *browser, cef_size_t *new_size) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mNewSize = new CefSize(new_size->width, new_size->height); if (OnAutoResize(mBrowser, ref mNewSize)) { new_size->width = mNewSize.Width; new_size->height = mNewSize.Height; return(1); } return(0); }
/// <summary> /// Called when the browser is about to display a tooltip. |text| /// contains the text that will be displayed in the tooltip. To handle /// the display of the tooltip yourself return true. Otherwise, you can /// optionally modify |text| and then return false to allow the browser /// to display the tooltip. /// </summary> private int on_tooltip(cef_display_handler_t *self, cef_browser_t *browser, cef_string_t *text) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_text = cef_string_t.ToString(text); var o_text = m_text; var handled = this.OnTooltip(m_browser, ref m_text); if (!handled && (object)m_text != (object)o_text) { cef_string_t.Copy(m_text, text); } return(handled ? 1 : 0); }
protected CefDisplayHandler() { _self = cef_display_handler_t.Alloc(); _ds0 = new cef_display_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_display_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_display_handler_t.get_refct_delegate(get_refct); _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_display_handler_t.on_address_change_delegate(on_address_change); _self->_on_address_change = Marshal.GetFunctionPointerForDelegate(_ds3); _ds4 = new cef_display_handler_t.on_title_change_delegate(on_title_change); _self->_on_title_change = Marshal.GetFunctionPointerForDelegate(_ds4); _ds5 = new cef_display_handler_t.on_tooltip_delegate(on_tooltip); _self->_on_tooltip = Marshal.GetFunctionPointerForDelegate(_ds5); _ds6 = new cef_display_handler_t.on_status_message_delegate(on_status_message); _self->_on_status_message = Marshal.GetFunctionPointerForDelegate(_ds6); _ds7 = new cef_display_handler_t.on_console_message_delegate(on_console_message); _self->_on_console_message = Marshal.GetFunctionPointerForDelegate(_ds7); }