Пример #1
0
        private int on_before_navigation(cef_render_process_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, CefNavigationType navigation_type, int is_redirect)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);
            var mFrame   = CefFrame.FromNative(frame);
            var mRequest = CefRequest.FromNative(request);

            var result = OnBeforeNavigation(mBrowser, mFrame, mRequest, navigation_type, is_redirect != 0);

            return(result ? 1 : 0);
        }
Пример #2
0
        private void on_uncaught_exception(cef_render_process_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_v8context_t *context, cef_v8exception_t *exception, cef_v8stack_trace_t *stackTrace)
        {
            CheckSelf(self);

            var mBrowser    = CefBrowser.FromNative(browser);
            var mFrame      = CefFrame.FromNative(frame);
            var mContext    = CefV8Context.FromNative(context);
            var mException  = CefV8Exception.FromNative(exception);
            var mStackTrace = CefV8StackTrace.FromNative(stackTrace);

            OnUncaughtException(mBrowser, mFrame, mContext, mException, mStackTrace);
        }
Пример #3
0
        private int can_get_cookies(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);
            var mFrame   = CefFrame.FromNative(frame);
            var mRequest = CefRequest.FromNative(request);

            var mResult = CanGetCookies(mBrowser, mFrame, mRequest);

            return(mResult ? 1 : 0);
        }
Пример #4
0
        private int on_resource_response(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_response_t *response)
        {
            CheckSelf(self);

            var m_browser  = CefBrowser.FromNative(browser);
            var m_frame    = CefFrame.FromNative(frame);
            var m_request  = CefRequest.FromNative(request);
            var m_response = CefResponse.FromNative(response);

            var m_result = OnResourceResponse(m_browser, m_frame, m_request, m_response);

            return(m_result ? 1 : 0);
        }
Пример #5
0
        private int on_open_urlfrom_tab(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_string_t *target_url, CefWindowOpenDisposition target_disposition, int user_gesture)
        {
            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_userGesture = user_gesture != 0;

            var m_result = OnOpenUrlFromTab(m_browser, m_frame, m_targetUrl, target_disposition, m_userGesture);

            return(m_result ? 1 : 0);
        }
Пример #6
0
        private int on_before_browse(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, int is_redirect)
        {
            CheckSelf(self);

            var m_browser    = CefBrowser.FromNative(browser);
            var m_frame      = CefFrame.FromNative(frame);
            var m_request    = CefRequest.FromNative(request);
            var m_isRedirect = is_redirect != 0;

            var result = OnBeforeBrowse(m_browser, m_frame, m_request, m_isRedirect);

            return(result ? 1 : 0);
        }
Пример #7
0
        private int on_before_resource_load(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame   = CefFrame.FromNative(frame);
            var m_request = CefRequest.FromNative(request);

            var result = OnBeforeResourceLoad(m_browser, m_frame, m_request);

            m_request.Dispose();

            return(result ? 1 : 0);
        }
Пример #8
0
        private int on_context_menu_command(cef_context_menu_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, int command_id, CefEventFlags event_flags)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);
            var mFrame   = CefFrame.FromNative(frame);
            var mState   = CefContextMenuParams.FromNative(@params);

            var result = OnContextMenuCommand(mBrowser, mFrame, mState, command_id, event_flags);

            mState.Dispose();

            return(result ? 1 : 0);
        }
Пример #9
0
        private void on_before_context_menu(cef_context_menu_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, cef_menu_model_t *model)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);
            var mFrame   = CefFrame.FromNative(frame);
            var mState   = CefContextMenuParams.FromNative(@params);
            var mModel   = CefMenuModel.FromNative(model);

            OnBeforeContextMenu(mBrowser, mFrame, mState, mModel);

            mState.Dispose();
            mModel.Dispose();
        }
Пример #10
0
        private CefReturnValue on_before_resource_load(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_request_callback_t *callback)
        {
            CheckSelf(self);

            var m_browser  = CefBrowser.FromNative(browser);
            var m_frame    = CefFrame.FromNative(frame);
            var m_request  = CefRequest.FromNative(request);
            var m_callback = CefRequestCallback.FromNative(callback);
            var result     = OnBeforeResourceLoad(m_browser, m_frame, m_request, m_callback);

            m_request.Dispose();

            return(result);
        }
Пример #11
0
        private cef_resource_handler_t *get_resource_handler(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame   = CefFrame.FromNative(frame);
            var m_request = CefRequest.FromNative(request);

            var handler = GetResourceHandler(m_browser, m_frame, m_request);

            m_request.Dispose();

            return(handler != null?handler.ToNative() : null);
        }
        private int on_process_message_received(cef_render_process_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, CefProcessId source_process, cef_process_message_t *message)
        {
            CheckSelf(self);

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

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

            m_message.Dispose();

            return(result ? 1 : 0);
        }
        private void on_focused_node_changed(cef_render_process_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_domnode_t *node)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame   = CefFrame.FromNative(frame);
            var m_node    = CefDomNode.FromNativeOrNull(node);

            OnFocusedNodeChanged(m_browser, m_frame, m_node);

            if (m_node != null)
            {
                m_node.Dispose();
            }
        }
Пример #14
0
        private int get_auth_credentials(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, int isProxy, cef_string_t *host, int port, cef_string_t *realm, cef_string_t *scheme, cef_auth_callback_t *callback)
        {
            CheckSelf(self);

            var m_browser  = CefBrowser.FromNative(browser);
            var m_frame    = CefFrame.FromNative(frame);
            var m_host     = cef_string_t.ToString(host);
            var m_realm    = cef_string_t.ToString(realm);
            var m_scheme   = cef_string_t.ToString(scheme);
            var m_callback = CefAuthCallback.FromNative(callback);

            var result = GetAuthCredentials(m_browser, m_frame, isProxy != 0, m_host, port, m_realm, m_scheme, m_callback);

            return(result ? 1 : 0);
        }
        private int run_context_menu(cef_context_menu_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_context_menu_params_t * @params, cef_menu_model_t *model, cef_run_context_menu_callback_t *callback)
        {
            CheckSelf(self);

            var mBrowser    = CefBrowser.FromNative(browser);
            var mFrame      = CefFrame.FromNative(frame);
            var mParameters = CefContextMenuParams.FromNative(@params);
            var mModel      = CefMenuModel.FromNative(model);
            var mCallback   = CefRunContextMenuCallback.FromNative(callback);
            var result      = RunContextMenu(mBrowser, mFrame, mParameters, mModel, mCallback);

            mParameters.Dispose();
            mModel.Dispose();

            return(result ? 1 : 0);
        }
Пример #16
0
        private cef_response_filter_t *get_resource_response_filter(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_request_t *request, cef_response_t *response)
        {
            CheckSelf(self);

            var mBrowser  = CefBrowser.FromNative(browser);
            var mFrame    = CefFrame.FromNative(frame);
            var mRequest  = CefRequest.FromNative(request);
            var mResponse = CefResponse.FromNative(response);

            var result = GetResourceResponseFilter(mBrowser, mFrame, mRequest, mResponse);

            if (result != null)
            {
                return(result.ToNative());
            }

            return(null);
        }
Пример #17
0
        private void on_resource_redirect(cef_request_handler_t *self, cef_browser_t *browser, cef_frame_t *frame, cef_string_t *old_url, cef_string_t *new_url)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_frame   = CefFrame.FromNative(frame);
            var m_oldUrl  = cef_string_t.ToString(old_url);
            var m_newUrl  = cef_string_t.ToString(new_url);

            var o_newUrl = m_newUrl;

            OnResourceRedirect(m_browser, m_frame, m_oldUrl, ref m_newUrl);

            if ((object)m_newUrl != (object)o_newUrl)
            {
                cef_string_t.Copy(m_newUrl, new_url);
            }
        }
Пример #18
0
        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, CefWindowOpenDisposition target_disposition, int user_gesture, cef_popup_features_t *popupFeatures, cef_window_info_t *windowInfo, cef_client_t **client, cef_browser_settings_t *settings, cef_dictionary_value_t **extra_info, 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_userGesture        = user_gesture != 0;
            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_extraInfo          = CefDictionaryValue.FromNativeOrNull(*extra_info);
            var m_noJavascriptAccess = (*no_javascript_access) != 0;

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

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

            if ((object)o_extraInfo != m_extraInfo)
            {
                *extra_info = m_extraInfo != null?m_extraInfo.ToNative() : null;
            }

            *no_javascript_access = m_noJavascriptAccess ? 1 : 0;

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

            return(result ? 1 : 0);
        }
 /// <summary>
 /// Returns the focused frame for the browser window.
 /// </summary>
 public CefFrame GetFocusedFrame()
 {
     return(CefFrame.FromNative(
                cef_browser_t.get_focused_frame(_self)
                ));
 }
 /// <summary>
 /// Returns the main (top-level) frame for the browser window.
 /// </summary>
 public CefFrame GetMainFrame()
 {
     return(CefFrame.FromNative(
                cef_browser_t.get_main_frame(_self)
                ));
 }