Package-level declarations
Types
Notify the host application to close the given WebView and remove it from the view system if necessary. At this point, WebCore has stopped any loading in this window and has removed any cross-scripting ability in javascript.
Report a JavaScript console message to the host application. The ChromeClient should override this to process the log message as they see fit.
Request the host application to create a new window. If the host application chooses to honor this request, it should return true
from this method, create a new WebView to host the window, insert it into the View system and send the supplied resultMsg message to its target with the new WebView as an argument. If the host application chooses not to honor the request, it should return false
from this method. The default implementation of this method does nothing and hence returns false
.
As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
Notify the host application that a request for Geolocation permissions, made with a previous call to GeolocationPermissionsShowPromptEvent has been canceled. Any related UI should therefore be hidden.
Notify the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin. The host application should invoke the specified callback with the desired permission state. See GeolocationPermissions for details.
Notify the host application that the current page has exited full screen mode. The host application must hide the custom View (the View which was previously passed to ShowCustomViewEvent). After this call, web content will render in the original WebView again.
Notify the host application that the web page wants to display a JavaScript alert()
dialog. The default behavior if this method returns false
or is not overridden is to show a dialog containing the alert message and suspend JavaScript execution until the dialog is dismissed. To show a custom dialog, the app should return true
from this method, in which case the default dialog will not be shown and JavaScript execution will be suspended. The app should call JsResult.confirm()
when the custom dialog is dismissed such that JavaScript execution can be resumed. To suppress the dialog and allow JavaScript execution to continue, call JsResult.confirm()
immediately and then return true
. Note that if the WebChromeClient is set to be null
, or if WebChromeClient is not set at all, the default dialog will be suppressed and Javascript execution will continue immediately. Note that the default dialog does not inherit the android.view.Display.FLAG_SECURE flag from the parent window.
Notify the host application that the web page wants to confirm navigation from JavaScript onbeforeunload
. The default behavior if this method returns false
or is not overridden is to show a dialog containing the message and suspend JavaScript execution until the dialog is dismissed. The default dialog will continue the navigation if the user confirms the navigation, and will stop the navigation if the user wants to stay on the current page. To show a custom dialog, the app should return true
from this method, in which case the default dialog will not be shown and JavaScript execution will be suspended. When the custom dialog is dismissed, the app should call JsResult.confirm()
to continue the navigation or, JsResult.cancel()
to stay on the current page. To suppress the dialog and allow JavaScript execution to continue, call JsResult.confirm()
or JsResult.cancel()
immediately and then return true
. Note that if the WebChromeClient is set to be null
, or if WebChromeClient is not set at all, the default dialog will be suppressed and the navigation will be resumed immediately. Note that the default dialog does not inherit the android.view.Display.FLAG_SECURE flag from the parent window.
Notify the host application that the web page wants to display a JavaScript confirm()
dialog. The default behavior if this method returns false
or is not overridden is to show a dialog containing the message and suspend JavaScript execution until the dialog is dismissed. The default dialog will return true
to the JavaScript confirm()
code when the user presses the 'confirm' button, and will return false
to the JavaScript code when the user presses the 'cancel' button or dismisses the dialog. To show a custom dialog, the app should return true
from this method, in which case the default dialog will not be shown and JavaScript execution will be suspended. The app should call JsResult.confirm()
or JsResult.cancel()
when the custom dialog is dismissed. To suppress the dialog and allow JavaScript execution to continue, call JsResult.confirm()
or JsResult.cancel()
immediately and then return true
. Note that if the WebChromeClient is set to be null
, or if WebChromeClient is not set at all, the default dialog will be suppressed and the default value of false
will be returned to the JavaScript code immediately. Note that the default dialog does not inherit the android.view.Display.FLAG_SECURE flag from the parent window.
Notify the host application that the web page wants to display a JavaScript prompt()
dialog. The default behavior if this method returns false
or is not overridden is to show a dialog containing the message and suspend JavaScript execution until the dialog is dismissed. Once the dialog is dismissed, JavaScript prompt()
will return the string that the user typed in, or null if the user presses the 'cancel' button. To show a custom dialog, the app should return true
from this method, in which case the default dialog will not be shown and JavaScript execution will be suspended. The app should call JsPromptResult.confirm(result)
when the custom dialog is dismissed. To suppress the dialog and allow JavaScript execution to continue, call JsPromptResult.confirm(result)
immediately and then return true
. Note that if the WebChromeClient is set to be null
, or if WebChromeClient is not set at all, the default dialog will be suppressed and null
will be returned to the JavaScript code immediately. Note that the default dialog does not inherit the android.view.Display.FLAG_SECURE flag from the parent window.
Notify the host application that the WebView will load the resource specified by the given url.
Notify the host application that WebView content left over from previous page navigations will no longer be drawn.
Notify the host application that a page has finished loading. This method is called only for main frame. Receiving an onPageFinished()
callback does not guarantee that the next frame drawn by WebView will reflect the state of the DOM at this point. In order to be notified that the current DOM state is ready to be rendered, request a visual state callback with WebView.postVisualStateCallback and wait for the supplied callback to be triggered.
Notify the host application that a page has started loading. This method is called once for each main frame load so a page with iframes or framesets will call onPageStarted one time for the main frame. This also means that onPageStarted will not be called when the contents of an embedded frame changes, i.e. clicking a link whose target is an iframe, it will also not be called for fragment navigations (navigations to #fragment_id).
Notify the host application that the given permission request has been canceled. Any related UI should therefore be hidden.
Notify the host application that web content is requesting permission to access the specified resources and the permission currently isn't granted or denied. The host application must invoke PermissionRequest.grant or PermissionRequest.deny.
Tell the host application the current progress of loading a page.
Posts DownloadStartEvent when the WebView requests to start a file download.
Posts various events triggered by the WebView.
Notify the host application to handle a SSL client certificate request. The host application is responsible for showing the UI if desired and providing the keys. There are three ways to respond: ClientCertRequest.proceed, ClientCertRequest.cancel, or ClientCertRequest.ignore. Webview stores the response in memory (for the life of the application) if ClientCertRequest.proceed or ClientCertRequest.cancel is called and does not call onReceivedClientCertRequest()
again for the same host and port pair. Webview does not store the response if ClientCertRequest.ignore is called. Note that, multiple layers in chromium network stack might be caching the responses, so the behavior for ignore is only a best case effort.
Report web resource loading error to the host application. These errors usually indicate inability to connect to the server. Note that unlike the deprecated version of the callback, the new version will be called for any resource (iframe, image, etc.), not just for the main page. Thus, it is recommended to perform minimum required work in this callback.
Notifies the host application that the WebView received an HTTP authentication request. The host application can use the supplied HttpAuthHandler to set the WebView's response to the request. The default behavior is to cancel the request.
Notify the host application that an HTTP error has been received from the server while loading a resource. HTTP errors have status codes >= 400. This callback will be called for any resource (iframe, image, etc.), not just for the main page. Thus, it is recommended to perform minimum required work in this callback. Note that the content of the server response may not be provided within the errorResponse
parameter.
Notify the host application of a new favicon for the current page.
Notify the host application that a request to automatically log in the user has been processed.
Notify the host application that an SSL error occurred while loading a resource. The host application must call either SslErrorHandler.cancel or SslErrorHandler.proceed. Note that the decision may be retained for use in response to future SSL errors. The default behavior is to cancel the load.
Notify the host application of a change in the document title.
Notify the host application of the url for an apple-touch-icon.
Notify host application that the given WebView's render process has exited.
Request display and focus for this WebView. This may happen due to another WebView opening a link in this WebView and requesting that this WebView be displayed.
Notify the host application that a loading URL has been flagged by Safe Browsing.
Notify the host application that the scale applied to the WebView has changed.
Notify the host application of a resource request and allow the application to return the data. If the return value is null
, the WebView will continue to load the resource as usual. Otherwise, the return response and data will be used.
Give the host application a chance to handle the key event synchronously. e.g. menu shortcut key events need to be filtered this way. If return true, WebView will not handle the key event. If return false
, WebView will always handle the key event, so none of the super in the view chain will see the key event. The default behavior returns false
.
Give the host application a chance to take control when a URL is about to be loaded in the current WebView. If a WebViewClient is not provided, by default WebView will ask Activity Manager to choose the proper handler for the URL. If a WebViewClient is provided, returning true
causes the current WebView to abort loading the URL, while returning false
causes the WebView to continue loading the URL as usual.
Notify the host application that the current page has entered full screen mode. After this call, web content will no longer be rendered in the WebView, but will instead be rendered in view
. The host application should add this View to a Window which is configured with android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN flag in order to actually display this web content full screen.
Tell the client to show a file chooser.
Notify the host application that a key was not handled by the WebView. Except system keys, WebView always consumes the keys in the normal flow or if ShouldOverrideKeyEventEvent returns true
. This is called asynchronously from where the key is dispatched. It gives the host application a chance to handle the unhandled key events.
Notify the host application to update its visited links database.