protected override bool OnBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, CefHandlerNavType navType, bool isRedirect)
        {
            #if DIAGNOSTICS
            Cef.Logger.Trace(LogTarget.CefRequestHandler, "OnBeforeBrowse: Method=[{0}] Url=[{1}] NavType=[{2}] IsRedirect=[{3}]", request.GetMethod(), request.GetURL(), navType, isRedirect);
            #endif

            var cancel = this.context.OnNavigating(frame, request, navType, isRedirect);
            if (cancel) return true;

            if (frame.IsMain)
            {
                // browser navigating to a new page
                this.context.ClearFrames();
                this.context.AttachMainFrame(frame);

                this.context.ClearReadyState();
                this.context.SetFrameReadyState(null, FrameReadyState.Navigating);
            }
            else if ((this.context.ReadyOptions & CefReadyOptions.Frames) != 0)
            {
                this.context.SetFrameReadyState(frame.GetName(), FrameReadyState.Navigating);
            }

            return false;
        }
Beispiel #2
0
        protected override bool OnBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, CefHandlerNavType navType, bool isRedirect)
        {
#if DIAGNOSTICS
            Cef.Logger.Trace(LogTarget.CefRequestHandler, "OnBeforeBrowse: Method=[{0}] Url=[{1}] NavType=[{2}] IsRedirect=[{3}]", request.GetMethod(), request.GetURL(), navType, isRedirect);
#endif

            var cancel = this.context.OnNavigating(frame, request, navType, isRedirect);
            if (cancel)
            {
                return(true);
            }

            if (frame.IsMain)
            {
                // browser navigating to a new page
                this.context.ClearFrames();
                this.context.AttachMainFrame(frame);

                this.context.ClearReadyState();
                this.context.SetFrameReadyState(null, FrameReadyState.Navigating);
            }
            else if ((this.context.ReadyOptions & CefReadyOptions.Frames) != 0)
            {
                this.context.SetFrameReadyState(frame.GetName(), FrameReadyState.Navigating);
            }

            return(false);
        }