Provides additional functionality for BBWebView. More...
Inherits BBWebChromeClientImpl.
Class provides additional functionality for BBWebView. These include:
Public Member Functions | |
BBWebChromeClient () | |
Creates BBWebChromeClient object. | |
BBWebChromeClient (WebClientObserver clientObserver) | |
Creates BBWebChromeClient object. More... | |
boolean | onConsoleMessage (android.webkit.ConsoleMessage consoleMessage) |
Redirects logs from JavaScript console inside Dynamics runtime. More... | |
boolean | onJsPrompt (WebView view, String url, String message, String defaultValue, JsPromptResult result) |
Shows JavaScript prompt dialog with passed massage. More... | |
void | onProgressChanged (WebView view, int newProgress) |
Notifies about progress change attached listeners. More... | |
void | onReceivedTitle (WebView view, String title) |
Notify the host application of a change in the document title. More... | |
void | onReceivedIcon (WebView view, Bitmap icon) |
Notify the host application of a new favicon for the current page. More... | |
void | onReceivedTouchIconUrl (WebView view, String url, boolean precomposed) |
Notify the host application of the url for an apple-touch-icon. More... | |
void | onShowCustomView (View view, CustomViewCallback callback) |
Notify the host application that the current page has entered full screen mode. More... | |
void | onShowCustomView (View view, int requestedOrientation, CustomViewCallback callback) |
Notify the host application that the current page would like to show a custom View in a particular orientation. More... | |
void | onHideCustomView () |
Notify the host application that the current page has exited full screen mode. More... | |
boolean | onCreateWindow (WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) |
Request the host application to create a new window. More... | |
void | onRequestFocus (WebView view) |
Request display and focus for this WebView. More... | |
void | onCloseWindow (WebView window) |
Notify the host application to close the given WebView and remove it from the view system if necessary. More... | |
boolean | onJsAlert (WebView view, String url, String message, JsResult result) |
Notify the host application that the web page wants to display a JavaScript. More... | |
boolean | onJsConfirm (WebView view, String url, String message, JsResult result) |
Notify the host application that the web page wants to display a JavaScript. More... | |
boolean | onJsBeforeUnload (WebView view, String url, String message, JsResult result) |
Notify the host application that the web page wants to confirm navigation from JavaScript. More... | |
void | onExceededDatabaseQuota (String url, String databaseIdentifier, long quota, long estimatedDatabaseSize, long totalQuota, WebStorage.QuotaUpdater quotaUpdater) |
Tell the client that the quota has been exceeded for the Web SQL Database API for a particular origin and request a new quota. More... | |
void | onGeolocationPermissionsShowPrompt (String origin, GeolocationPermissions.Callback callback) |
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. More... | |
void | onGeolocationPermissionsHidePrompt () |
Notify the host application that a request for Geolocation permissions, made with a previous call to onGeolocationPermissionsShowPrompt(String,GeolocationPermissions.Callback) onGeolocationPermissionsShowPrompt() has been canceled. More... | |
void | onPermissionRequest (PermissionRequest request) |
Notify the host application that web content is requesting permission to access the specified resources and the permission currently isn't granted or denied. More... | |
void | onPermissionRequestCanceled (PermissionRequest request) |
Notify the host application that the given permission request has been canceled. More... | |
boolean | onJsTimeout () |
Tell the client that a JavaScript execution timeout has occured. More... | |
void | onConsoleMessage (String message, int lineNumber, String sourceID) |
Report a JavaScript error message to the host application. More... | |
Bitmap | getDefaultVideoPoster () |
When not playing, video elements are represented by a 'poster' image. More... | |
View | getVideoLoadingProgressView () |
Obtains a View to be displayed while buffering of full screen video is taking place. More... | |
void | getVisitedHistory (ValueCallback< String[]> callback) |
Obtains a list of all visited history items, used for link coloring. | |
boolean | onShowFileChooser (WebView webView, ValueCallback< Uri[]> filePathCallback, FileChooserParams fileChooserParams) |
Tell the client to show a file chooser. More... | |
BBWebChromeClient | ( | WebClientObserver | clientObserver | ) |
clientObserver | - observer for progress changes of web page loading |
boolean onConsoleMessage | ( | android.webkit.ConsoleMessage | consoleMessage | ) |
consoleMessage | Object containing details of the console message. |
true
if the message is handled by the client. boolean onJsPrompt | ( | WebView | view, |
String | url, | ||
String | message, | ||
String | defaultValue, | ||
JsPromptResult | result | ||
) |
view | The WebView that initiated the callback. |
url | Not currently used. |
message | Message to be displayed in the window. |
defaultValue | The default value displayed in the prompt dialog. |
result | A JsPromptResult used to send the user's response to javascript. |
true
if the request is handled or ignored.false
if the WebView needs to show the default dialog. void onProgressChanged | ( | WebView | view, |
int | newProgress | ||
) |
Please, see WebClientObserver.
view | The WebView that initiated the callback. |
newProgress | Current page loading progress, represented by an integer between 0 and 100. |
void onReceivedTitle | ( | WebView | view, |
String | title | ||
) |
view | The WebView that initiated the callback. |
title | A String containing the new title of the document. |
void onReceivedIcon | ( | WebView | view, |
Bitmap | icon | ||
) |
view | The WebView that initiated the callback. |
icon | A Bitmap containing the favicon for the current page. |
void onReceivedTouchIconUrl | ( | WebView | view, |
String | url, | ||
boolean | precomposed | ||
) |
view | The WebView that initiated the callback. |
url | The icon url. |
precomposed | true if the url is for a precomposed touch icon. |
void onShowCustomView | ( | View | view, |
CustomViewCallback | callback | ||
) |
After this call, web content will no longer be rendered in the WebView, but will instead be rendered in
. 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.
The application may explicitly exit fullscreen mode by invoking
(ex. when the user presses the back button). However, this is generally not necessary as the web page will often show its own UI to close out of fullscreen. Regardless of how the WebView exits fullscreen mode, WebView will invoke onHideCustomView(), signaling for the application to remove the custom View.
If this method is not overridden, WebView will report to the web page it does not support fullscreen mode and will not honor the web page's request to run in fullscreen mode.
Note: if overriding this method, the application must also override onHideCustomView().
view | is the View object to be shown. |
callback | invoke this callback to request the page to exit full screen mode. |
void onShowCustomView | ( | View | view, |
int | requestedOrientation, | ||
CustomViewCallback | callback | ||
) |
view | is the View object to be shown. |
requestedOrientation | An orientation constant as used in ActivityInfo::screenOrientation ActivityInfo.screenOrientation. |
callback | is the callback to be invoked if and when the view is dismissed. |
void onHideCustomView | ( | ) |
The host application must hide the custom View (the View which was previously passed to onShowCustomView(View, CustomViewCallback) onShowCustomView()). After this call, web content will render in the original WebView again.
Note: if overriding this method, the application must also override onShowCustomView(View, CustomViewCallback) onShowCustomView().
boolean onCreateWindow | ( | WebView | view, |
boolean | isDialog, | ||
boolean | isUserGesture, | ||
Message | resultMsg | ||
) |
If the host application chooses to honor this request, it should return
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
from this method. The default implementation of this method does nothing and hence returns
.
Applications should typically not allow windows to be created when the
flag is false, as this may be an unwanted popup.
Applications should be careful how they display the new window: don't simply overlay it over the existing WebView as this may mislead the user about which site they are viewing. If your application displays the URL of the main page, make sure to also display the URL of the new window in a similar fashion. If your application does not display URLs, consider disallowing the creation of new windows entirely.
Note: There is no trustworthy way to tell which page requested the new window: the request might originate from a third-party iframe inside the WebView.
view | The WebView from which the request for a new window originated. |
isDialog | true if the new window should be a dialog, rather than a full-size window. |
isUserGesture | true if the request was initiated by a user gesture, such as the user clicking a link. |
resultMsg | The message to send when once a new WebView has been created. resultMsg.obj is a WebView.WebViewTransport object. This should be used to transport the new WebView, by calling WebView.WebViewTransport::setWebView(WebView) WebView.WebViewTransport.setWebView(WebView). |
void onRequestFocus | ( | WebView | view | ) |
This may happen due to another WebView opening a link in this WebView and requesting that this WebView be displayed.
view | The WebView that needs to be focused. |
void onCloseWindow | ( | WebView | window | ) |
At this point, WebCore has stopped any loading in this window and has removed any cross-scripting ability in javascript.
As with onCreateWindow, the application should ensure that any URL or security indicator displayed is updated so that the user can tell that the page they were interacting with has been closed.
window | The WebView that needs to be closed. |
boolean onJsAlert | ( | WebView | view, |
String | url, | ||
String | message, | ||
JsResult | result | ||
) |
dialog.
The default behavior if this method returns
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
from this method, in which case the default dialog will not be shown and JavaScript execution will be suspended. The app should call
when the custom dialog is dismissed such that JavaScript execution can be resumed.
To suppress the dialog and allow JavaScript execution to continue, call
immediately and then return
.
Note that if the WebChromeClient is set to be
, 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.
view | The WebView that initiated the callback. |
url | The url of the page requesting the dialog. |
message | Message to be displayed in the window. |
result | A JsResult to confirm that the user closed the window. |
boolean onJsConfirm | ( | WebView | view, |
String | url, | ||
String | message, | ||
JsResult | result | ||
) |
dialog.
The default behavior if this method returns
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
to the JavaScript
code when the user presses the 'confirm' button, and will return
to the JavaScript code when the user presses the 'cancel' button or dismisses the dialog.
To show a custom dialog, the app should return
from this method, in which case the default dialog will not be shown and JavaScript execution will be suspended. The app should call
or
when the custom dialog is dismissed.
To suppress the dialog and allow JavaScript execution to continue, call
or
immediately and then return
.
Note that if the WebChromeClient is set to be
, or if WebChromeClient is not set at all, the default dialog will be suppressed and the default value of
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.
view | The WebView that initiated the callback. |
url | The url of the page requesting the dialog. |
message | Message to be displayed in the window. |
result | A JsResult used to send the user's response to javascript. |
boolean onJsBeforeUnload | ( | WebView | view, |
String | url, | ||
String | message, | ||
JsResult | result | ||
) |
.
The default behavior if this method returns
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
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
to continue the navigation or,
to stay on the current page.
To suppress the dialog and allow JavaScript execution to continue, call
or
immediately and then return
.
Note that if the WebChromeClient is set to be
, 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.
view | The WebView that initiated the callback. |
url | The url of the page requesting the dialog. |
message | Message to be displayed in the window. |
result | A JsResult used to send the user's response to javascript. |
void onExceededDatabaseQuota | ( | String | url, |
String | databaseIdentifier, | ||
long | quota, | ||
long | estimatedDatabaseSize, | ||
long | totalQuota, | ||
WebStorage.QuotaUpdater | quotaUpdater | ||
) |
The client must respond by invoking the WebStorage.QuotaUpdater::updateQuota(long) updateQuota(long) method of the supplied WebStorage.QuotaUpdater instance. The minimum value that can be set for the new quota is the current quota. The default implementation responds with the current quota, so the quota will not be increased.
url | The URL of the page that triggered the notification |
databaseIdentifier | The identifier of the database where the quota was exceeded. |
quota | The quota for the origin, in bytes |
estimatedDatabaseSize | The estimated size of the offending database, in bytes |
totalQuota | The total quota for all origins, in bytes |
quotaUpdater | An instance of WebStorage.QuotaUpdater which must be used to inform the WebView of the new quota. |
void onGeolocationPermissionsShowPrompt | ( | String | origin, |
GeolocationPermissions.Callback | callback | ||
) |
The host application should invoke the specified callback with the desired permission state. See GeolocationPermissions for details.
Note that for applications targeting Android N and later SDKs (API level > android.os.Build.VERSION_CODES::M) this method is only called for requests originating from secure origins such as https. On non-secure origins geolocation requests are automatically denied.
origin | The origin of the web content attempting to use the Geolocation API. |
callback | The callback to use to set the permission state for the origin. |
void onGeolocationPermissionsHidePrompt | ( | ) |
Any related UI should therefore be hidden.
void onPermissionRequest | ( | PermissionRequest | request | ) |
The host application must invoke PermissionRequest::grant(String[]) or PermissionRequest::deny().
If this method isn't overridden, the permission is denied.
request | the PermissionRequest from current web content. |
void onPermissionRequestCanceled | ( | PermissionRequest | request | ) |
Any related UI should therefore be hidden.
request | the PermissionRequest that needs be canceled. |
boolean onJsTimeout | ( | ) |
And the client may decide whether or not to interrupt the execution. If the client returns
, the JavaScript will be interrupted. If the client returns
, the execution will continue. Note that in the case of continuing execution, the timeout counter will be reset, and the callback will continue to occur if the script does not finish at the next check point.
void onConsoleMessage | ( | String | message, |
int | lineNumber, | ||
String | sourceID | ||
) |
The ChromeClient should override this to process the log message as they see fit.
message | The error message to report. |
lineNumber | The line number of the error. |
sourceID | The name of the source file that caused the error. |
Bitmap getDefaultVideoPoster | ( | ) |
The image to use can be specified by the poster attribute of the video tag in HTML. If the attribute is absent, then a default poster will be used. This method allows the ChromeClient to provide that default image.
View getVideoLoadingProgressView | ( | ) |
The host application can override this method to provide a View containing a spinner or similar.
boolean onShowFileChooser | ( | WebView | webView, |
ValueCallback< Uri[]> | filePathCallback, | ||
FileChooserParams | fileChooserParams | ||
) |
This is called to handle HTML forms with 'file' input type, in response to the user pressing the "Select File" button. To cancel the request, call filePathCallback.onReceiveValue(null)
and return
.
webView | The WebView instance that is initiating the request. |
filePathCallback | Invoke this callback to supply the list of paths to files to upload, or null
true
|
fileChooserParams | Describes the mode of file chooser to be opened, and options to be used with it. |