Exemplo n.º 1
0
        private cef_dialog_handler_t *get_dialog_handler(cef_client_t *self)
        {
            CheckSelf(self);
            var result = GetDialogHandler();

            return(result != null?result.ToNative() : null);
        }
Exemplo n.º 2
0
        private cef_audio_handler_t *get_audio_handler(cef_client_t *self)
        {
            CheckSelf(self);
            var result = GetAudioHandler();

            return(result != null?result.ToNative() : null);
        }
Exemplo n.º 3
0
        private cef_context_menu_handler_t *get_context_menu_handler(cef_client_t *self)
        {
            CheckSelf(self);
            var result = GetContextMenuHandler();

            return(result != null?result.ToNative() : null);
        }
Exemplo n.º 4
0
 private void CheckSelf(cef_client_t *self)
 {
     if (_self != self)
     {
         throw ExceptionBuilder.InvalidSelfReference();
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Return the handler for focus events.
        /// </summary>
        private cef_focus_handler_t *get_focus_handler(cef_client_t *self)
        {
            ThrowIfObjectDisposed();

            var handler = GetFocusHandler();

            return(handler == null ? null : handler.GetNativePointerAndAddRef());
        }
Exemplo n.º 6
0
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_client_t.Free(_self);
         _self = null;
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Return the handler for browser life span events.
        /// </summary>
        private cef_life_span_handler_t *get_life_span_handler(cef_client_t *self)
        {
            ThrowIfObjectDisposed();

            var handler = GetLifeSpanHandler();

            return(handler == null ? null : handler.GetNativePointerAndAddRef());
        }
Exemplo n.º 8
0
        private cef_request_handler_t *get_request_handler(cef_client_t *self)
        {
            CheckSelf(self);

            var result = GetRequestHandler();

            return(result != null?result.ToNative() : null);
        }
Exemplo n.º 9
0
        private cef_keyboard_handler_t *get_keyboard_handler(cef_client_t *self)
        {
            CheckSelf(self);

            var result = GetKeyboardHandler();

            return(result != null?result.ToNative() : null);
        }
Exemplo n.º 10
0
        private cef_life_span_handler_t *get_life_span_handler(cef_client_t *self)
        {
            CheckSelf(self);

            var result = GetLifeSpanHandler();

            return(result != null?result.ToNative() : null);
        }
Exemplo n.º 11
0
        private cef_focus_handler_t *get_focus_handler(cef_client_t *self)
        {
            CheckSelf(self);

            var result = GetFocusHandler();

            return(result != null?result.ToNative() : null);
        }
Exemplo n.º 12
0
        private cef_geolocation_handler_t *get_geolocation_handler(cef_client_t *self)
        {
            CheckSelf(self);

            var result = GetGeolocationHandler();

            return(result != null?result.ToNative() : null);
        }
Exemplo n.º 13
0
        internal static CefClient FromNative(cef_client_t *ptr)
        {
            var value = FromNativeOrNull(ptr);

            if (value == null)
            {
                throw ExceptionBuilder.ObjectNotFound();
            }
            return(value);
        }
Exemplo n.º 14
0
        internal static CefClient FromNativeOrNull(cef_client_t *ptr)
        {
            CefClient value = null;
            bool      found;

            lock (_roots)
            {
                found = _roots.TryGetValue((IntPtr)ptr, out value);
            }
            return(found ? value : null);
        }
Exemplo n.º 15
0
 private void add_ref(cef_client_t *self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
     }
 }
Exemplo n.º 16
0
 private int release(cef_client_t *self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return(result);
     }
 }
Exemplo n.º 17
0
        private int on_process_message_received(cef_client_t *self, cef_browser_t *browser, CefProcessId source_process, cef_process_message_t *message)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_message = CefProcessMessage.FromNative(message);

            var result = OnProcessMessageReceived(m_browser, source_process, m_message);

            // m_browser.Dispose();
            m_message.Dispose();

            return(result ? 1 : 0);
        }
Exemplo n.º 18
0
        public CefClient()
        {
            RequestHandler  = new CefRequestHandler(this);
            LifeSpanHandler = new CefLifeSpanHandler(this);
            DownloadHandler = new CefDownloadHandler(this);
            LoadHandler     = new CefLoadHandler(this);

            cef_client_t *self = FixedPtr;

            self->get_request_handler         = holder_get_request_handler;
            self->get_life_span_handler       = holder_get_life_span_handler;
            self->get_download_handler        = holder_get_download_handler;
            self->get_load_handler            = holder_get_load_handler;
            self->on_process_message_received = holder_on_process_message_received;
        }
Exemplo n.º 19
0
        protected CefClient()
        {
            _self = cef_client_t.Alloc();

            _ds0 = new cef_client_t.add_ref_delegate(add_ref);
            _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
            _ds1 = new cef_client_t.release_delegate(release);
            _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
            _ds2 = new cef_client_t.has_one_ref_delegate(has_one_ref);
            _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2);
            _ds3 = new cef_client_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_client_t.get_audio_handler_delegate(get_audio_handler);
            _self->_get_audio_handler = Marshal.GetFunctionPointerForDelegate(_ds4);
            _ds5 = new cef_client_t.get_context_menu_handler_delegate(get_context_menu_handler);
            _self->_get_context_menu_handler = Marshal.GetFunctionPointerForDelegate(_ds5);
            _ds6 = new cef_client_t.get_dialog_handler_delegate(get_dialog_handler);
            _self->_get_dialog_handler = Marshal.GetFunctionPointerForDelegate(_ds6);
            _ds7 = new cef_client_t.get_display_handler_delegate(get_display_handler);
            _self->_get_display_handler = Marshal.GetFunctionPointerForDelegate(_ds7);
            _ds8 = new cef_client_t.get_download_handler_delegate(get_download_handler);
            _self->_get_download_handler = Marshal.GetFunctionPointerForDelegate(_ds8);
            _ds9 = new cef_client_t.get_drag_handler_delegate(get_drag_handler);
            _self->_get_drag_handler = Marshal.GetFunctionPointerForDelegate(_ds9);
            _dsa = new cef_client_t.get_find_handler_delegate(get_find_handler);
            _self->_get_find_handler = Marshal.GetFunctionPointerForDelegate(_dsa);
            _dsb = new cef_client_t.get_focus_handler_delegate(get_focus_handler);
            _self->_get_focus_handler = Marshal.GetFunctionPointerForDelegate(_dsb);
            _dsc = new cef_client_t.get_frame_handler_delegate(get_frame_handler);
            _self->_get_frame_handler = Marshal.GetFunctionPointerForDelegate(_dsc);
            _dsd = new cef_client_t.get_jsdialog_handler_delegate(get_jsdialog_handler);
            _self->_get_jsdialog_handler = Marshal.GetFunctionPointerForDelegate(_dsd);
            _dse = new cef_client_t.get_keyboard_handler_delegate(get_keyboard_handler);
            _self->_get_keyboard_handler = Marshal.GetFunctionPointerForDelegate(_dse);
            _dsf = new cef_client_t.get_life_span_handler_delegate(get_life_span_handler);
            _self->_get_life_span_handler = Marshal.GetFunctionPointerForDelegate(_dsf);
            _ds10 = new cef_client_t.get_load_handler_delegate(get_load_handler);
            _self->_get_load_handler = Marshal.GetFunctionPointerForDelegate(_ds10);
            _ds11 = new cef_client_t.get_print_handler_delegate(get_print_handler);
            _self->_get_print_handler = Marshal.GetFunctionPointerForDelegate(_ds11);
            _ds12 = new cef_client_t.get_render_handler_delegate(get_render_handler);
            _self->_get_render_handler = Marshal.GetFunctionPointerForDelegate(_ds12);
            _ds13 = new cef_client_t.get_request_handler_delegate(get_request_handler);
            _self->_get_request_handler = Marshal.GetFunctionPointerForDelegate(_ds13);
            _ds14 = new cef_client_t.on_process_message_received_delegate(on_process_message_received);
            _self->_on_process_message_received = Marshal.GetFunctionPointerForDelegate(_ds14);
        }
Exemplo n.º 20
0
        public CefClient()
        {
            cef_client_t *self = this.NativeInstance;

            self->get_context_menu_handler    = (void *)Marshal.GetFunctionPointerForDelegate(fnGetContextMenuHandler);
            self->get_dialog_handler          = (void *)Marshal.GetFunctionPointerForDelegate(fnGetDialogHandler);
            self->get_display_handler         = (void *)Marshal.GetFunctionPointerForDelegate(fnGetDisplayHandler);
            self->get_download_handler        = (void *)Marshal.GetFunctionPointerForDelegate(fnGetDownloadHandler);
            self->get_drag_handler            = (void *)Marshal.GetFunctionPointerForDelegate(fnGetDragHandler);
            self->get_find_handler            = (void *)Marshal.GetFunctionPointerForDelegate(fnGetFindHandler);
            self->get_focus_handler           = (void *)Marshal.GetFunctionPointerForDelegate(fnGetFocusHandler);
            self->get_jsdialog_handler        = (void *)Marshal.GetFunctionPointerForDelegate(fnGetJSDialogHandler);
            self->get_keyboard_handler        = (void *)Marshal.GetFunctionPointerForDelegate(fnGetKeyboardHandler);
            self->get_life_span_handler       = (void *)Marshal.GetFunctionPointerForDelegate(fnGetLifeSpanHandler);
            self->get_load_handler            = (void *)Marshal.GetFunctionPointerForDelegate(fnGetLoadHandler);
            self->get_render_handler          = (void *)Marshal.GetFunctionPointerForDelegate(fnGetRenderHandler);
            self->get_request_handler         = (void *)Marshal.GetFunctionPointerForDelegate(fnGetRequestHandler);
            self->on_process_message_received = (void *)Marshal.GetFunctionPointerForDelegate(fnOnProcessMessageReceived);
        }
Exemplo n.º 21
0
        public CefClient()
        {
            cef_client_t *self = this.NativeInstance;

                        #if NET_LESS_5_0
            self->get_audio_handler           = (void *)Marshal.GetFunctionPointerForDelegate(fnGetAudioHandler);
            self->get_context_menu_handler    = (void *)Marshal.GetFunctionPointerForDelegate(fnGetContextMenuHandler);
            self->get_dialog_handler          = (void *)Marshal.GetFunctionPointerForDelegate(fnGetDialogHandler);
            self->get_display_handler         = (void *)Marshal.GetFunctionPointerForDelegate(fnGetDisplayHandler);
            self->get_download_handler        = (void *)Marshal.GetFunctionPointerForDelegate(fnGetDownloadHandler);
            self->get_drag_handler            = (void *)Marshal.GetFunctionPointerForDelegate(fnGetDragHandler);
            self->get_find_handler            = (void *)Marshal.GetFunctionPointerForDelegate(fnGetFindHandler);
            self->get_focus_handler           = (void *)Marshal.GetFunctionPointerForDelegate(fnGetFocusHandler);
            self->get_frame_handler           = (void *)Marshal.GetFunctionPointerForDelegate(fnGetFrameHandler);
            self->get_jsdialog_handler        = (void *)Marshal.GetFunctionPointerForDelegate(fnGetJSDialogHandler);
            self->get_keyboard_handler        = (void *)Marshal.GetFunctionPointerForDelegate(fnGetKeyboardHandler);
            self->get_life_span_handler       = (void *)Marshal.GetFunctionPointerForDelegate(fnGetLifeSpanHandler);
            self->get_load_handler            = (void *)Marshal.GetFunctionPointerForDelegate(fnGetLoadHandler);
            self->get_print_handler           = (void *)Marshal.GetFunctionPointerForDelegate(fnGetPrintHandler);
            self->get_render_handler          = (void *)Marshal.GetFunctionPointerForDelegate(fnGetRenderHandler);
            self->get_request_handler         = (void *)Marshal.GetFunctionPointerForDelegate(fnGetRequestHandler);
            self->on_process_message_received = (void *)Marshal.GetFunctionPointerForDelegate(fnOnProcessMessageReceived);
                        #else
            self->get_audio_handler           = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_audio_handler_t * >) & GetAudioHandlerImpl;
            self->get_context_menu_handler    = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_context_menu_handler_t * >) & GetContextMenuHandlerImpl;
            self->get_dialog_handler          = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_dialog_handler_t * >) & GetDialogHandlerImpl;
            self->get_display_handler         = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_display_handler_t * >) & GetDisplayHandlerImpl;
            self->get_download_handler        = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_download_handler_t * >) & GetDownloadHandlerImpl;
            self->get_drag_handler            = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_drag_handler_t * >) & GetDragHandlerImpl;
            self->get_find_handler            = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_find_handler_t * >) & GetFindHandlerImpl;
            self->get_focus_handler           = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_focus_handler_t * >) & GetFocusHandlerImpl;
            self->get_frame_handler           = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_frame_handler_t * >) & GetFrameHandlerImpl;
            self->get_jsdialog_handler        = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_jsdialog_handler_t * >) & GetJSDialogHandlerImpl;
            self->get_keyboard_handler        = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_keyboard_handler_t * >) & GetKeyboardHandlerImpl;
            self->get_life_span_handler       = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_life_span_handler_t * >) & GetLifeSpanHandlerImpl;
            self->get_load_handler            = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_load_handler_t * >) & GetLoadHandlerImpl;
            self->get_print_handler           = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_print_handler_t * >) & GetPrintHandlerImpl;
            self->get_render_handler          = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_render_handler_t * >) & GetRenderHandlerImpl;
            self->get_request_handler         = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_request_handler_t * >) & GetRequestHandlerImpl;
            self->on_process_message_received = (delegate * unmanaged[Stdcall] < cef_client_t *, cef_browser_t *, cef_frame_t *, CefProcessId, cef_process_message_t *, int >) & OnProcessMessageReceivedImpl;
                        #endif
        }
Exemplo n.º 22
0
 protected CefClient()
 {
     _self = cef_client_t.Alloc();
 
     _ds0 = new cef_client_t.add_ref_delegate(add_ref);
     _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
     _ds1 = new cef_client_t.release_delegate(release);
     _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
     _ds2 = new cef_client_t.get_refct_delegate(get_refct);
     _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2);
     _ds3 = new cef_client_t.get_context_menu_handler_delegate(get_context_menu_handler);
     _self->_get_context_menu_handler = Marshal.GetFunctionPointerForDelegate(_ds3);
     _ds4 = new cef_client_t.get_dialog_handler_delegate(get_dialog_handler);
     _self->_get_dialog_handler = Marshal.GetFunctionPointerForDelegate(_ds4);
     _ds5 = new cef_client_t.get_display_handler_delegate(get_display_handler);
     _self->_get_display_handler = Marshal.GetFunctionPointerForDelegate(_ds5);
     _ds6 = new cef_client_t.get_download_handler_delegate(get_download_handler);
     _self->_get_download_handler = Marshal.GetFunctionPointerForDelegate(_ds6);
     _ds7 = new cef_client_t.get_drag_handler_delegate(get_drag_handler);
     _self->_get_drag_handler = Marshal.GetFunctionPointerForDelegate(_ds7);
     _ds8 = new cef_client_t.get_focus_handler_delegate(get_focus_handler);
     _self->_get_focus_handler = Marshal.GetFunctionPointerForDelegate(_ds8);
     _ds9 = new cef_client_t.get_geolocation_handler_delegate(get_geolocation_handler);
     _self->_get_geolocation_handler = Marshal.GetFunctionPointerForDelegate(_ds9);
     _dsa = new cef_client_t.get_jsdialog_handler_delegate(get_jsdialog_handler);
     _self->_get_jsdialog_handler = Marshal.GetFunctionPointerForDelegate(_dsa);
     _dsb = new cef_client_t.get_keyboard_handler_delegate(get_keyboard_handler);
     _self->_get_keyboard_handler = Marshal.GetFunctionPointerForDelegate(_dsb);
     _dsc = new cef_client_t.get_life_span_handler_delegate(get_life_span_handler);
     _self->_get_life_span_handler = Marshal.GetFunctionPointerForDelegate(_dsc);
     _dsd = new cef_client_t.get_load_handler_delegate(get_load_handler);
     _self->_get_load_handler = Marshal.GetFunctionPointerForDelegate(_dsd);
     _dse = new cef_client_t.get_render_handler_delegate(get_render_handler);
     _self->_get_render_handler = Marshal.GetFunctionPointerForDelegate(_dse);
     _dsf = new cef_client_t.get_request_handler_delegate(get_request_handler);
     _self->_get_request_handler = Marshal.GetFunctionPointerForDelegate(_dsf);
     _ds10 = new cef_client_t.on_process_message_received_delegate(on_process_message_received);
     _self->_on_process_message_received = Marshal.GetFunctionPointerForDelegate(_ds10);
 }
Exemplo n.º 23
0
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_client_t.Free(_self);
         _self = null;
     }
 }
Exemplo n.º 24
0
 internal static void Free(cef_client_t *ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
Exemplo n.º 25
0
        /// <summary>
        /// Return the handler for find result events.
        /// </summary>
        // protected abstract cef_find_handler_t* GetFindHandler();

        private cef_focus_handler_t *get_focus_handler(cef_client_t *self)
        {
            CheckSelf(self);
            throw new NotImplementedException(); // TODO: CefClient.GetFocusHandler
        }
Exemplo n.º 26
0
        /// <summary>
        /// Return the handler for focus events.
        /// </summary>
        // protected abstract cef_focus_handler_t* GetFocusHandler();

        private cef_geolocation_handler_t *get_geolocation_handler(cef_client_t *self)
        {
            CheckSelf(self);
            throw new NotImplementedException(); // TODO: CefClient.GetGeolocationHandler
        }
Exemplo n.º 27
0
 public unsafe extern void ShowDevTools([Immutable] cef_window_info_t *windowInfo, cef_client_t *client, [Immutable] cef_browser_settings_t *settings, [Immutable] cef_point_t *inspect_element_at);
Exemplo n.º 28
0
 private int has_at_least_one_ref(cef_client_t *self)
 {
     lock (SyncRoot) { return(_refct != 0 ? 1 : 0); }
 }
Exemplo n.º 29
0
 private int has_one_ref(cef_client_t *self)
 {
     lock (SyncRoot) { return(_refct == 1 ? 1 : 0); }
 }
Exemplo n.º 30
0
 public static extern cef_browser_t *create_browser_sync(cef_window_info_t *windowInfo, cef_client_t *client, cef_string_t *url, cef_browser_settings_t *settings, cef_request_context_t *request_context);
Exemplo n.º 31
0
 public CefClient(cef_client_t *instance)
     : base((cef_base_ref_counted_t *)instance)
 {
 }
Exemplo n.º 32
0
        public static void show_dev_tools(cef_browser_host_t *self, cef_window_info_t *windowInfo, cef_client_t *client, cef_browser_settings_t *settings)
        {
            show_dev_tools_delegate d;
            var p = self->_show_dev_tools;

            if (p == _p12)
            {
                d = _d12;
            }
            else
            {
                d = (show_dev_tools_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(show_dev_tools_delegate));
                if (_p12 == IntPtr.Zero)
                {
                    _d12 = d; _p12 = p;
                }
            }
            d(self, windowInfo, client, settings);
        }