Class CefRequestHandlerAdapter

  • All Implemented Interfaces:
    CefRequestHandler

    public abstract class CefRequestHandlerAdapter
    extends java.lang.Object
    implements CefRequestHandler
    An abstract adapter class for receiving browser request events. The methods in this class are empty. This class exists as convenience for creating handler objects.
    • Constructor Detail

      • CefRequestHandlerAdapter

        public CefRequestHandlerAdapter()
    • Method Detail

      • onBeforeBrowse

        public boolean onBeforeBrowse​(CefBrowser browser,
                                      CefFrame frame,
                                      CefRequest request,
                                      boolean user_gesture,
                                      boolean is_redirect)
        Description copied from interface: CefRequestHandler
        Called on the UI thread before browser navigation. CefLoadHandler.onLoadingStateChange() will be called twice in all cases. If the navigation is allowed CefLoadHandler.onLoadStart() and CefLoadHandler.onLoadEnd() will be called. If the navigation is canceled CefLoadHandler.onLoadError() will be called with an errorCode value of ERR_ABORTED.
        Specified by:
        onBeforeBrowse in interface CefRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. Cannot be modified in this callback. Instance only valid within the scope of this method.
        user_gesture - True if the request was initiated by a user gesture.
        is_redirect - True if the request was redirected.
        Returns:
        True to cancel the navigation or false to continue.
      • onOpenURLFromTab

        public boolean onOpenURLFromTab​(CefBrowser browser,
                                        CefFrame frame,
                                        java.lang.String target_url,
                                        boolean user_gesture)
        Description copied from interface: CefRequestHandler
        Called on the UI thread before OnBeforeBrowse in certain limited cases where navigating a new or different browser might be desirable. This includes user-initiated navigation that might open in a special way (e.g. links clicked via middle-click or ctrl + left-click) and certain types of cross-origin navigation initiated from the renderer process (e.g. navigating the top-level frame to/from a file URL).
        Specified by:
        onOpenURLFromTab in interface CefRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method
        user_gesture - True if the request was initiated by a user gesture.
        Returns:
        True to cancel navigation or false to continue
      • getResourceRequestHandler

        public CefResourceRequestHandler getResourceRequestHandler​(CefBrowser browser,
                                                                   CefFrame frame,
                                                                   CefRequest request,
                                                                   boolean isNavigation,
                                                                   boolean isDownload,
                                                                   java.lang.String requestInitiator,
                                                                   BoolRef disableDefaultHandling)
        Description copied from interface: CefRequestHandler
        Called on the IO thread before a resource request is initiated. The |browser| and |frame| values represent the source of the request. If this callback returns null the same method will be called on the associated CefRequestContextHandler, if any.
        Specified by:
        getResourceRequestHandler in interface CefRequestHandler
        Parameters:
        browser - The corresponding browser.
        frame - The frame generating the event. Instance only valid within the scope of this method.
        request - The request itself. Cannot be modified in this callback. Instance only valid within the scope of this method.
        isNavigation - True if the resource request is a navigation.
        isDownload - True if the resource request is a download.
        requestInitiator - The origin (scheme + domain) of the page that initiated the request.
        disableDefaultHandling - Set to true to disable default handling of the request, in which case it will need to be handled via CefResourceRequestHandler.getResourceHandler or it will be canceled.
        Returns:
        A CefResourceRequestHandler instance or null.
      • getAuthCredentials

        public boolean getAuthCredentials​(CefBrowser browser,
                                          java.lang.String origin_url,
                                          boolean isProxy,
                                          java.lang.String host,
                                          int port,
                                          java.lang.String realm,
                                          java.lang.String scheme,
                                          CefAuthCallback callback)
        Description copied from interface: CefRequestHandler
        Called on the IO thread when the browser needs credentials from the user.
        Specified by:
        getAuthCredentials in interface CefRequestHandler
        Parameters:
        browser - The corresponding browser.
        origin_url - The origin making this authentication request.
        isProxy - True if the host is a proxy server.
        host - Hostname.
        port - Port number.
        realm - Realm of the request.
        scheme - Scheme of the request.
        callback - Call CefAuthCallback.Continue() when the authentication information is available.
        Returns:
        True to continue the request (callback must be executed) or false to cancel.
      • onCertificateError

        public boolean onCertificateError​(CefBrowser browser,
                                          CefLoadHandler.ErrorCode cert_error,
                                          java.lang.String request_url,
                                          CefCallback callback)
        Description copied from interface: CefRequestHandler
        Called on the UI thread to handle requests for URLs with an invalid SSL certificate. If "ignore-certificate-errors" command-line switch is set all invalid certificates will be accepted without calling this method.
        Specified by:
        onCertificateError in interface CefRequestHandler
        Parameters:
        browser - The corresponding browser.
        cert_error - Error code describing the error.
        request_url - The requesting URL.
        callback - Call CefCallback.Continue() either in this method or at a later time to continue or cancel the request. If null the error cannot be recovered from and the request will be canceled automatically.
        Returns:
        True to handle the request (callback must be executed) or false to reject it.
      • onRenderProcessTerminated

        public void onRenderProcessTerminated​(CefBrowser browser,
                                              CefRequestHandler.TerminationStatus status,
                                              int error_code,
                                              java.lang.String error_string)
        Description copied from interface: CefRequestHandler
        Called on the browser process UI thread when the render process terminates unexpectedly.
        Specified by:
        onRenderProcessTerminated in interface CefRequestHandler
        Parameters:
        browser - The corresponding browser.
        status - Indicates how the process was terminated.
        error_code - The process error code.
        error_string - A string description of the error.