private void CheckSelf(cef_find_handler_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_find_handler_t.Free(_self); _self = null; } }
private void on_find_result(cef_find_handler_t *self, cef_browser_t *browser, int identifier, int count, cef_rect_t *selectionRect, int activeMatchOrdinal, int finalUpdate) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mSelectionRect = new CefRectangle(selectionRect->x, selectionRect->y, selectionRect->width, selectionRect->height); OnFindResult(mBrowser, identifier, count, mSelectionRect, activeMatchOrdinal, finalUpdate != 0); }
public CefFindHandler() { cef_find_handler_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_find_result = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFindResult); #else self->on_find_result = (delegate * unmanaged[Stdcall] < cef_find_handler_t *, cef_browser_t *, int, int, cef_rect_t *, int, int, void >) & OnFindResultImpl; #endif }
/// <summary> /// Called to report find results returned by CefBrowser::Find(). /// |identifer| is the identifier passed to CefBrowser::Find(), |count| /// is the number of matches currently identified, |selectionRect| is the /// location of where the match was found (in window coordinates), /// |activeMatchOrdinal| is the current position in the search results, /// and |finalUpdate| is true if this is the last find notification. /// </summary> private void on_find_result(cef_find_handler_t *self, cef_browser_t *browser, int identifier, int count, /*const*/ cef_rect_t *selectionRect, int activeMatchOrdinal, int finalUpdate) { ThrowIfObjectDisposed(); var m_browser = CefBrowser.From(browser); var m_selectionRect = CefRect.From(selectionRect); var m_finalUpdate = finalUpdate != 0; this.OnFindResult(m_browser, identifier, count, m_selectionRect, activeMatchOrdinal, m_finalUpdate); }
private void add_ref(cef_find_handler_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
// void (*)(_cef_find_handler_t* self, _cef_browser_t* browser, int identifier, int count, const cef_rect_t* selectionRect, int activeMatchOrdinal, int finalUpdate)* private static unsafe void OnFindResultImpl(cef_find_handler_t *self, cef_browser_t *browser, int identifier, int count, cef_rect_t *selectionRect, int activeMatchOrdinal, int finalUpdate) { var instance = GetInstance((IntPtr)self) as CefFindHandler; if (instance == null || ((ICefFindHandlerPrivate)instance).AvoidOnFindResult()) { ReleaseIfNonNull((cef_base_ref_counted_t *)browser); return; } instance.OnFindResult(CefBrowser.Wrap(CefBrowser.Create, browser), identifier, count, *(CefRect *)selectionRect, activeMatchOrdinal, finalUpdate != 0); }
private int release(cef_find_handler_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } return(1); } return(0); } }
protected CefFindHandler() { _self = cef_find_handler_t.Alloc(); _ds0 = new cef_find_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_find_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_find_handler_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_find_handler_t.on_find_result_delegate(on_find_result); _self->_on_find_result = Marshal.GetFunctionPointerForDelegate(_ds3); }
private int has_at_least_one_ref(cef_find_handler_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
private int has_one_ref(cef_find_handler_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }
internal static void Free(cef_find_handler_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
public CefFindHandler(cef_find_handler_t *instance) : base((cef_base_ref_counted_t *)instance) { }
public CefFindHandler() { cef_find_handler_t *self = this.NativeInstance; self->on_find_result = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFindResult); }
private void on_find_result(cef_find_handler_t *self, cef_browser_t *browser, int identifier, int count, cef_rect_t *selectionRect, int activeMatchOrdinal, int finalUpdate) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefFindHandler.OnFindResult }