Esempio n. 1
0
        private cef_drag_handler_t* get_drag_handler(cef_client_t* self)
        {
            CheckSelf(self);

            var result = GetDragHandler();
            return result != null ? result.ToNative() : null;
        }
        private int on_before_popup(cef_life_span_handler_t* self, cef_browser_t* browser, cef_frame_t* frame, cef_string_t* target_url, cef_string_t* target_frame_name, cef_popup_features_t* popupFeatures, cef_window_info_t* windowInfo, cef_client_t** client, cef_browser_settings_t* settings, int* no_javascript_access)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame = CefFrame.FromNative(frame);
            var m_targetUrl = cef_string_t.ToString(target_url);
            var m_targetFrameName = cef_string_t.ToString(target_frame_name);
            var m_popupFeatures = new CefPopupFeatures(popupFeatures);
            var m_windowInfo = CefWindowInfo.FromNative(windowInfo);
            var m_client = CefClient.FromNative(*client);
            var m_settings = new CefBrowserSettings(settings);
            var m_noJavascriptAccess = (*no_javascript_access) != 0;

            var o_client = m_client;
            var result = OnBeforePopup(m_browser, m_frame, m_targetUrl, m_targetFrameName, m_popupFeatures, m_windowInfo, ref m_client, m_settings, ref m_noJavascriptAccess);

            if ((object)o_client != m_client && m_client != null)
            {
                *client = m_client.ToNative();
            }

            *no_javascript_access = m_noJavascriptAccess ? 1 : 0;

            m_popupFeatures.Dispose();
            m_windowInfo.Dispose();
            m_settings.Dispose();

            return result ? 1 : 0;
        }
Esempio n. 3
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;
 }
Esempio n. 4
0
 private int release(cef_client_t* self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return result;
     }
 }
Esempio n. 5
0
 private int add_ref(cef_client_t* self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
         return result;
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Return the handler for zoom events. If no handler is provided the default
        /// zoom behavior will be used.
        /// </summary>
        private cef_zoom_handler_t* get_zoom_handler(cef_client_t* self)
        {
            ThrowIfObjectDisposed();

            var handler = GetZoomHandler();
            return handler == null ? null : handler.GetNativePointerAndAddRef();
        }
Esempio 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();
        }
        /// <summary>
        /// Called before a new popup window is created.
        /// The |parentBrowser| parameter will point to the parent browser window.
        /// The |popupFeatures| parameter will contain information about the style of popup window requested.
        /// Return false to have the framework create the new popup window based on the parameters in |windowInfo|.
        /// Return true to cancel creation of the popup window.
        /// By default, a newly created popup window will have the same client and settings as the parent window.
        /// To change the client for the new window modify the object that |client| points to.
        /// To change the settings for the new window modify the |settings| structure.
        /// </summary>
        private int on_before_popup(cef_life_span_handler_t* self, cef_browser_t* parentBrowser, /*const*/ cef_popup_features_t* popupFeatures, cef_window_info_t* windowInfo, /*const*/ cef_string_t* url, cef_client_t** client, cef_browser_settings_t* settings)
        {
            ThrowIfObjectDisposed();

            var m_client = CefClient.From(*client);
            var m_parentBrowser = CefBrowser.From(parentBrowser);
            var m_popupFeatures = CefPopupFeatures.From(popupFeatures);
            var m_windowInfo = CefWindowInfo.From(windowInfo);
            var m_url = cef_string_t.ToString(url);
            var m_settings = CefBrowserSettings.From(settings);

            var o_client = m_client;
            var handled = this.OnBeforePopup(m_parentBrowser, m_popupFeatures, m_windowInfo, m_url, ref m_client, m_settings);

            if (!handled && m_client != o_client && m_client != null)
            {
                *client = m_client.GetNativePointerAndAddRef();
            }

            m_popupFeatures.Dispose();
            m_windowInfo.Dispose();
            m_settings.Dispose();

            return handled ? 1 : 0;
        }
Esempio n. 9
0
        private cef_geolocation_handler_t* get_geolocation_handler(cef_client_t* self)
        {
            CheckSelf(self);

            var result = GetGeolocationHandler();
            return result != null ? result.ToNative() : null;
        }
Esempio n. 10
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;
        }
Esempio n. 11
0
        private cef_request_handler_t* get_request_handler(cef_client_t* self)
        {
            CheckSelf(self);

            var result = GetRequestHandler();
            return result != null ? result.ToNative() : null;
        }
Esempio n. 12
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;
        }
Esempio n. 13
0
        private cef_keyboard_handler_t* get_keyboard_handler(cef_client_t* self)
        {
            CheckSelf(self);

            var result = GetKeyboardHandler();
            return result != null ? result.ToNative() : null;
        }
Esempio n. 14
0
        private cef_jsdialog_handler_t* get_jsdialog_handler(cef_client_t* self)
        {
            CheckSelf(self);

            var result = GetJSDialogHandler();
            return result != null ? result.ToNative() : null;
        }
Esempio n. 15
0
 private int get_refct(cef_client_t* self)
 {
     return _refct;
 }
Esempio n. 16
0
 private void CheckSelf(cef_client_t* self)
 {
     if (_self != self) throw ExceptionBuilder.InvalidSelfReference();
 }
 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);
Esempio n. 18
0
 internal static CefClient FromNative(cef_client_t* ptr)
 {
     var value = FromNativeOrNull(ptr);
     if (value == null) throw ExceptionBuilder.ObjectNotFound();
     return value;
 }
Esempio n. 19
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;
 }