FileDocCategorySizeDatePackage
WebChromeClient.javaAPI DocAndroid 1.5 API7331Wed May 06 22:41:56 BST 2009android.webkit

WebChromeClient

public class WebChromeClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public voidonCloseWindow(WebView window)
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.

param
window The WebView that needs to be closed.

public booleanonCreateWindow(WebView view, boolean dialog, boolean userGesture, android.os.Message resultMsg)
Request the host application to create a new Webview. The host application should handle placement of the new WebView in the view system. The default behavior returns null.

param
view The WebView that initiated the callback.
param
dialog True if the new window is meant to be a small dialog window.
param
userGesture True if the request was initiated by a user gesture such as clicking a link.
param
resultMsg The message to send when done creating a new WebView. Set the new WebView through resultMsg.obj which is WebView.WebViewTransport() and then call resultMsg.sendToTarget();
return
Similar to javscript dialogs, this method should return true if the client is going to handle creating a new WebView. Note that the WebView will halt processing if this method returns true so make sure to call resultMsg.sendToTarget(). It is undefined behavior to call resultMsg.sendToTarget() after returning false from this method.

        return false;
    
public booleanonJsAlert(WebView view, java.lang.String url, java.lang.String message, JsResult result)
Tell the client to display a javascript alert dialog. If the client returns true, WebView will assume that the client will handle the dialog. If the client returns false, it will continue execution.

param
view The WebView that initiated the callback.
param
url The url of the page requesting the dialog.
param
message Message to be displayed in the window.
param
result A JsResult to confirm that the user hit enter.
return
boolean Whether the client will handle the alert dialog.

        return false;
    
public booleanonJsBeforeUnload(WebView view, java.lang.String url, java.lang.String message, JsResult result)
Tell the client to display a dialog to confirm navigation away from the current page. This is the result of the onbeforeunload javascript event. If the client returns true, WebView will assume that the client will handle the confirm dialog and call the appropriate JsResult method. If the client returns false, a default value of true will be returned to javascript to accept navigation away from the current page. The default behavior is to return false. Setting the JsResult to true will navigate away from the current page, false will cancel the navigation.

param
view The WebView that initiated the callback.
param
url The url of the page requesting the dialog.
param
message Message to be displayed in the window.
param
result A JsResult used to send the user's response to javascript.
return
boolean Whether the client will handle the confirm dialog.

        return false;
    
public booleanonJsConfirm(WebView view, java.lang.String url, java.lang.String message, JsResult result)
Tell the client to display a confirm dialog to the user. If the client returns true, WebView will assume that the client will handle the confirm dialog and call the appropriate JsResult method. If the client returns false, a default value of false will be returned to javascript. The default behavior is to return false.

param
view The WebView that initiated the callback.
param
url The url of the page requesting the dialog.
param
message Message to be displayed in the window.
param
result A JsResult used to send the user's response to javascript.
return
boolean Whether the client will handle the confirm dialog.

        return false;
    
public booleanonJsPrompt(WebView view, java.lang.String url, java.lang.String message, java.lang.String defaultValue, JsPromptResult result)
Tell the client to display a prompt dialog to the user. If the client returns true, WebView will assume that the client will handle the prompt dialog and call the appropriate JsPromptResult method. If the client returns false, a default value of false will be returned to to javascript. The default behavior is to return false.

param
view The WebView that initiated the callback.
param
url The url of the page requesting the dialog.
param
message Message to be displayed in the window.
param
defaultValue The default value displayed in the prompt dialog.
param
result A JsPromptResult used to send the user's reponse to javascript.
return
boolean Whether the client will handle the prompt dialog.

        return false;
    
public voidonProgressChanged(WebView view, int newProgress)
Tell the host application the current progress of loading a page.

param
view The WebView that initiated the callback.
param
newProgress Current page loading progress, represented by an integer between 0 and 100.

public voidonReceivedIcon(WebView view, android.graphics.Bitmap icon)
Notify the host application of a new favicon for the current page.

param
view The WebView that initiated the callback.
param
icon A Bitmap containing the favicon for the current page.

public voidonReceivedTitle(WebView view, java.lang.String title)
Notify the host application of a change in the document title.

param
view The WebView that initiated the callback.
param
title A String containing the new title of the document.

public voidonRequestFocus(WebView view)
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.

param
view The WebView that needs to be focused.