Package-level declarations

Types

Link copied to clipboard
class CloseWindowEvent(val window: WebView)

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.

Link copied to clipboard

Report a JavaScript console message to the host application. The ChromeClient should override this to process the log message as they see fit.

Link copied to clipboard
class CreateWindowEvent(val view: WebView, val isDialog: Boolean, val isUserGesture: Boolean, val resultMessage: Message) : SyncHandlerEvent

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.

Link copied to clipboard
class DownloadStartEvent(val url: String, val userAgent: String, val contentDisposition: String, val mimeType: String, val contentLength: Long)

Notifies the host application that a file should be downloaded.

Link copied to clipboard
class FormResubmissionEvent(val view: WebView, val dontResend: Message, val resend: Message) : SyncHandlerEvent

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.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard
class JsAlertEvent(val view: WebView, val url: String, val message: String, val result: JsResult) : SyncHandlerEvent

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.

Link copied to clipboard
class JsBeforeUnloadEvent(val view: WebView, val url: String, val message: String, val result: JsResult) : SyncHandlerEvent

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.

Link copied to clipboard
class JsConfirmEvent(val view: WebView, val url: String, val message: String, val result: JsResult) : SyncHandlerEvent

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.

Link copied to clipboard
class JsPromptEvent(val view: WebView, val url: String, val message: String, val defaultValue: String, val result: JsPromptResult) : SyncHandlerEvent

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.

Link copied to clipboard
class LoadResourceEvent(val view: WebView, val url: String)

Notify the host application that the WebView will load the resource specified by the given url.

Link copied to clipboard
class PageCommitVisibleEvent(val view: WebView, val url: String)

Notify the host application that WebView content left over from previous page navigations will no longer be drawn.

Link copied to clipboard
class PageFinishedEvent(val view: WebView, val url: String)

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.

Link copied to clipboard
class PageStartedEvent(val view: WebView, val url: String, val favicon: Bitmap?)

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).

Link copied to clipboard

Notify the host application that the given permission request has been canceled. Any related UI should therefore be hidden.

Link copied to clipboard

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.

Link copied to clipboard
class ProgressChangedEvent(val view: WebView, val progress: Int)

Tell the host application the current progress of loading a page.

Link copied to clipboard
open class RacehorseDownloadListener(eventBus: EventBus = EventBus.getDefault()) : DownloadListener

Posts DownloadStartEvent when the WebView requests to start a file download.

Link copied to clipboard
open class RacehorseWebChromeClient(eventBus: EventBus = EventBus.getDefault()) : WebChromeClient

Posts various events triggered by the WebView.

Link copied to clipboard
open class RacehorseWebViewClient(eventBus: EventBus = EventBus.getDefault()) : WebViewClient
Link copied to clipboard

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.

Link copied to clipboard
class ReceivedErrorEvent(val view: WebView, val request: WebResourceRequest, val error: WebResourceError)

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.

Link copied to clipboard
class ReceivedHttpAuthRequestEvent(val view: WebView, val handler: HttpAuthHandler, val host: String, val realm: String) : SyncHandlerEvent

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.

Link copied to clipboard
class ReceivedHttpErrorEvent(val view: WebView, val request: WebResourceRequest, val errorResponse: WebResourceResponse)

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.

Link copied to clipboard
class ReceivedIconEvent(val view: WebView, val icon: Bitmap)

Notify the host application of a new favicon for the current page.

Link copied to clipboard
class ReceivedLoginRequestEvent(val view: WebView, val realm: String, val account: String?, val args: String)

Notify the host application that a request to automatically log in the user has been processed.

Link copied to clipboard
class ReceivedSslErrorEvent(val view: WebView, val handler: SslErrorHandler, val error: SslError) : SyncHandlerEvent

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.

Link copied to clipboard
class ReceivedTitleEvent(val view: WebView, val title: String)

Notify the host application of a change in the document title.

Link copied to clipboard
class ReceivedTouchIconUrlEvent(val view: WebView, val url: String, val isPrecomposed: Boolean)

Notify the host application of the url for an apple-touch-icon.

Link copied to clipboard

Notify host application that the given WebView's render process has exited.

Link copied to clipboard
class RequestFocusEvent(val view: WebView)

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.

Link copied to clipboard
class SafeBrowsingHitEvent(val view: WebView, val request: WebResourceRequest, val threatType: Int, val callback: SafeBrowsingResponse)

Notify the host application that a loading URL has been flagged by Safe Browsing.

Link copied to clipboard
class ScaleChangedEvent(val view: WebView, val oldScale: Float, val newScale: Float)

Notify the host application that the scale applied to the WebView has changed.

Link copied to clipboard
class ShouldInterceptRequestEvent(val view: WebView, val request: WebResourceRequest, var response: WebResourceResponse?)

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.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard
class ShowFileChooserEvent(val view: WebView, val filePathCallback: ValueCallback<Array<Uri>?>, val fileChooserParams: WebChromeClient.FileChooserParams) : SyncHandlerEvent

Tell the client to show a file chooser.

Link copied to clipboard
class UnhandledKeyEventEvent(val view: WebView, val event: KeyEvent)

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.

Link copied to clipboard
class UpdateVisitedHistoryEvent(val view: WebView, val url: String, val isReload: Boolean)

Notify the host application to update its visited links database.