private void CheckSelf(cef_dialog_handler_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_dialog_handler_t.Free(_self); _self = null; } }
public CefDialogHandler() { cef_dialog_handler_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_file_dialog = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFileDialog); #else self->on_file_dialog = (delegate * unmanaged[Stdcall] < cef_dialog_handler_t *, cef_browser_t *, CefFileDialogMode, cef_string_t *, cef_string_t *, cef_string_list_t, int, cef_file_dialog_callback_t *, int >) & OnFileDialogImpl; #endif }
private void add_ref(cef_dialog_handler_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
private int release(cef_dialog_handler_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } } return(result); } }
protected CefDialogHandler() { _self = cef_dialog_handler_t.Alloc(); _ds0 = new cef_dialog_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_dialog_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_dialog_handler_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_dialog_handler_t.on_file_dialog_delegate(on_file_dialog); _self->_on_file_dialog = Marshal.GetFunctionPointerForDelegate(_ds3); }
protected CefDialogHandler() { _self = cef_dialog_handler_t.Alloc(); _ds0 = new cef_dialog_handler_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_dialog_handler_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_dialog_handler_t.get_refct_delegate(get_refct); _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_dialog_handler_t.on_file_dialog_delegate(on_file_dialog); _self->_on_file_dialog = Marshal.GetFunctionPointerForDelegate(_ds3); }
private int on_file_dialog(cef_dialog_handler_t *self, cef_browser_t *browser, CefFileDialogMode mode, cef_string_t *title, cef_string_t *default_file_name, cef_string_list *accept_types, cef_file_dialog_callback_t *callback) { CheckSelf(self); var mBrowser = CefBrowser.FromNative(browser); var mTitle = cef_string_t.ToString(title); var mDefaultFileName = cef_string_t.ToString(default_file_name); var mAcceptTypes = cef_string_list.ToArray(accept_types); var mCallback = CefFileDialogCallback.FromNative(callback); var result = OnFileDialog(mBrowser, mode, mTitle, mDefaultFileName, mAcceptTypes, mCallback); return(result ? 1 : 0); }
internal static void Free(cef_dialog_handler_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
private int has_at_least_one_ref(cef_dialog_handler_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
private int has_one_ref(cef_dialog_handler_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }
private int get_refct(cef_dialog_handler_t *self) { return(_refct); }
public CefDialogHandler(cef_dialog_handler_t *instance) : base((cef_base_ref_counted_t *)instance) { }
public CefDialogHandler() { cef_dialog_handler_t *self = this.NativeInstance; self->on_file_dialog = (void *)Marshal.GetFunctionPointerForDelegate(fnOnFileDialog); }
private int on_file_dialog(cef_dialog_handler_t *self, cef_browser_t *browser, CefFileDialogMode mode, cef_string_t *title, cef_string_t *default_file_path, cef_string_list *accept_filters, int selected_accept_filter, cef_file_dialog_callback_t *callback) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefDialogHandler.OnFileDialog }