Package org.cef.handler
Class CefRequestHandlerAdapter
- java.lang.Object
-
- org.cef.handler.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.cef.handler.CefRequestHandler
CefRequestHandler.TerminationStatus
-
-
Constructor Summary
Constructors Constructor Description CefRequestHandlerAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
Called on the IO thread when the browser needs credentials from the user.CefResourceRequestHandler
getResourceRequestHandler(CefBrowser browser, CefFrame frame, CefRequest request, boolean isNavigation, boolean isDownload, java.lang.String requestInitiator, BoolRef disableDefaultHandling)
Called on the IO thread before a resource request is initiated.boolean
onBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, boolean user_gesture, boolean is_redirect)
Called on the UI thread before browser navigation.boolean
onCertificateError(CefBrowser browser, CefLoadHandler.ErrorCode cert_error, java.lang.String request_url, CefRequestCallback callback)
Called on the UI thread to handle requests for URLs with an invalid SSL certificate.void
onPluginCrashed(CefBrowser browser, java.lang.String pluginPath)
Called on the browser process UI thread when a plugin has crashed.boolean
onQuotaRequest(CefBrowser browser, java.lang.String origin_url, long new_size, CefRequestCallback callback)
Called on the IO thread when JavaScript requests a specific storage quota size via the webkitStorageInfo.requestQuota function.void
onRenderProcessTerminated(CefBrowser browser, CefRequestHandler.TerminationStatus status)
Called on the browser process UI thread when the render process terminates unexpectedly.
-
-
-
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 interfaceCefRequestHandler
- 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.
-
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 interfaceCefRequestHandler
- 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 interfaceCefRequestHandler
- 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.
-
onQuotaRequest
public boolean onQuotaRequest(CefBrowser browser, java.lang.String origin_url, long new_size, CefRequestCallback callback)
Description copied from interface:CefRequestHandler
Called on the IO thread when JavaScript requests a specific storage quota size via the webkitStorageInfo.requestQuota function.- Specified by:
onQuotaRequest
in interfaceCefRequestHandler
- Parameters:
browser
- The corresponding browser.origin_url
- Origin of the page making the request.new_size
- Requested quota size in bytes.callback
- Call CefRequestCallback.Continue() either in this method or at a later time to grant or deny the request.- Returns:
- True to handle 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, CefRequestCallback 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 interfaceCefRequestHandler
- Parameters:
browser
- The corresponding browser.cert_error
- Error code describing the error.request_url
- The requesting URL.callback
- Call CefRequestCallback.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.
-
onPluginCrashed
public void onPluginCrashed(CefBrowser browser, java.lang.String pluginPath)
Description copied from interface:CefRequestHandler
Called on the browser process UI thread when a plugin has crashed.- Specified by:
onPluginCrashed
in interfaceCefRequestHandler
- Parameters:
browser
- The corresponding browser.pluginPath
- The path of the plugin that crashed.
-
onRenderProcessTerminated
public void onRenderProcessTerminated(CefBrowser browser, CefRequestHandler.TerminationStatus status)
Description copied from interface:CefRequestHandler
Called on the browser process UI thread when the render process terminates unexpectedly.- Specified by:
onRenderProcessTerminated
in interfaceCefRequestHandler
- Parameters:
browser
- The corresponding browser.status
- Indicates how the process was terminated.
-
-