Package org.cef.handler
Interface CefRequestHandler
-
- All Known Implementing Classes:
CefClient
,CefRequestHandlerAdapter
public interface CefRequestHandler
Implement this interface to handle events related to browser requests. The methods of this class will be called on the thread indicated.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
CefRequestHandler.TerminationStatus
Process termination status values.
-
Method Summary
All Methods Instance Methods Abstract 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
boolean onBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, boolean user_gesture, boolean is_redirect)
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.- 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
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. 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.- 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
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.- 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
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.- 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
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. If "ignore-certificate-errors" command-line switch is set all invalid certificates will be accepted without calling this method.- 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
void onPluginCrashed(CefBrowser browser, java.lang.String pluginPath)
Called on the browser process UI thread when a plugin has crashed.- Parameters:
browser
- The corresponding browser.pluginPath
- The path of the plugin that crashed.
-
onRenderProcessTerminated
void onRenderProcessTerminated(CefBrowser browser, CefRequestHandler.TerminationStatus status)
Called on the browser process UI thread when the render process terminates unexpectedly.- Parameters:
browser
- The corresponding browser.status
- Indicates how the process was terminated.
-
-