Merge "Improve documentation for WebChromeClient.onCreateWindow()"

This commit is contained in:
Steve Block
2011-10-17 02:30:41 -07:00
committed by Android (Google) Code Review

View File

@@ -95,27 +95,33 @@ public class WebChromeClient {
public void onHideCustomView() {} public void onHideCustomView() {}
/** /**
* Request the host application to create a new Webview. The host * Request the host application to create a new window. If the host
* application should handle placement of the new WebView in the view * application chooses to honor this request, it should return true from
* system. The default behavior returns null. * this method, create a new WebView to host the window, insert it into the
* @param view The WebView that initiated the callback. * View system and send the supplied resultMsg message to its target with
* @param dialog True if the new window is meant to be a small dialog * the new WebView as an argument. If the host application chooses not to
* window. * honor the request, it should return false from this method. The default
* @param userGesture True if the request was initiated by a user gesture * implementation of this method does nothing and hence returns false.
* such as clicking a link. * @param view The WebView from which the request for a new window
* @param resultMsg The message to send when done creating a new WebView. * originated.
* Set the new WebView through resultMsg.obj which is * @param isDialog True if the new window should be a dialog, rather than
* WebView.WebViewTransport() and then call * a full-size window.
* resultMsg.sendToTarget(); * @param isUserGesture True if the request was initiated by a user gesture,
* @return Similar to javscript dialogs, this method should return true if * such as the user clicking a link.
* the client is going to handle creating a new WebView. Note that * @param resultMsg The message to send when once a new WebView has been
* the WebView will halt processing if this method returns true so * created. resultMsg.obj is a
* make sure to call resultMsg.sendToTarget(). It is undefined * {@link WebView#WebViewTransport WebView.WebViewTransport}
* behavior to call resultMsg.sendToTarget() after returning false * object. This should be used to transport the new
* from this method. * WebView, by calling
* {@link WebView#WebViewTransport#setWebView() WebView.WebViewTransport.setWebView()}.
* @return This method should return true if the host application will
* create a new window, in which case resultMsg should be sent to
* its target. Otherwise, this method should return false. Returning
* false from this method but also sending resultMsg will result in
* undefined behavior.
*/ */
public boolean onCreateWindow(WebView view, boolean dialog, public boolean onCreateWindow(WebView view, boolean isDialog,
boolean userGesture, Message resultMsg) { boolean isUserGesture, Message resultMsg) {
return false; return false;
} }