The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.webkit; |
| 18 | |
Derek Sollenberger | 7ab3d67 | 2011-06-01 14:45:05 -0400 | [diff] [blame] | 19 | import android.content.pm.ActivityInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 20 | import android.graphics.Bitmap; |
Leon Scroggins | 70ca3c2 | 2009-10-02 15:58:55 -0400 | [diff] [blame] | 21 | import android.net.Uri; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 22 | import android.os.Message; |
Andrei Popescu | 6fa2958 | 2009-06-19 14:54:09 +0100 | [diff] [blame] | 23 | import android.view.View; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | |
| 25 | public class WebChromeClient { |
| 26 | |
| 27 | /** |
| 28 | * Tell the host application the current progress of loading a page. |
| 29 | * @param view The WebView that initiated the callback. |
| 30 | * @param newProgress Current page loading progress, represented by |
| 31 | * an integer between 0 and 100. |
| 32 | */ |
| 33 | public void onProgressChanged(WebView view, int newProgress) {} |
| 34 | |
| 35 | /** |
| 36 | * Notify the host application of a change in the document title. |
| 37 | * @param view The WebView that initiated the callback. |
| 38 | * @param title A String containing the new title of the document. |
| 39 | */ |
| 40 | public void onReceivedTitle(WebView view, String title) {} |
| 41 | |
| 42 | /** |
| 43 | * Notify the host application of a new favicon for the current page. |
| 44 | * @param view The WebView that initiated the callback. |
| 45 | * @param icon A Bitmap containing the favicon for the current page. |
| 46 | */ |
| 47 | public void onReceivedIcon(WebView view, Bitmap icon) {} |
| 48 | |
| 49 | /** |
Patrick Scott | 2ba1262 | 2009-08-04 13:20:05 -0400 | [diff] [blame] | 50 | * Notify the host application of the url for an apple-touch-icon. |
| 51 | * @param view The WebView that initiated the callback. |
| 52 | * @param url The icon url. |
Patrick Scott | d58ccff | 2009-09-18 16:29:00 -0400 | [diff] [blame] | 53 | * @param precomposed True if the url is for a precomposed touch icon. |
Patrick Scott | 2ba1262 | 2009-08-04 13:20:05 -0400 | [diff] [blame] | 54 | */ |
Patrick Scott | d58ccff | 2009-09-18 16:29:00 -0400 | [diff] [blame] | 55 | public void onReceivedTouchIconUrl(WebView view, String url, |
| 56 | boolean precomposed) {} |
Patrick Scott | 2ba1262 | 2009-08-04 13:20:05 -0400 | [diff] [blame] | 57 | |
| 58 | /** |
Andrei Popescu | 3c946a1a | 2009-07-03 08:20:53 +0100 | [diff] [blame] | 59 | * A callback interface used by the host application to notify |
| 60 | * the current page that its custom view has been dismissed. |
Andrei Popescu | 6fa2958 | 2009-06-19 14:54:09 +0100 | [diff] [blame] | 61 | */ |
Andrei Popescu | 3c946a1a | 2009-07-03 08:20:53 +0100 | [diff] [blame] | 62 | public interface CustomViewCallback { |
| 63 | /** |
| 64 | * Invoked when the host application dismisses the |
| 65 | * custom view. |
| 66 | */ |
| 67 | public void onCustomViewHidden(); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Notify the host application that the current page would |
Kristian Monsen | 0e0b2da | 2013-04-10 13:43:43 -0700 | [diff] [blame] | 72 | * like to show a custom View. This is used for Fullscreen |
| 73 | * video playback; see "HTML5 Video support" documentation on |
| 74 | * {@link WebView}. |
Andrei Popescu | 3c946a1a | 2009-07-03 08:20:53 +0100 | [diff] [blame] | 75 | * @param view is the View object to be shown. |
| 76 | * @param callback is the callback to be invoked if and when the view |
| 77 | * is dismissed. |
Andrei Popescu | 3c946a1a | 2009-07-03 08:20:53 +0100 | [diff] [blame] | 78 | */ |
| 79 | public void onShowCustomView(View view, CustomViewCallback callback) {}; |
Andrei Popescu | 6fa2958 | 2009-06-19 14:54:09 +0100 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * Notify the host application that the current page would |
Derek Sollenberger | 7ab3d67 | 2011-06-01 14:45:05 -0400 | [diff] [blame] | 83 | * like to show a custom View in a particular orientation. |
| 84 | * @param view is the View object to be shown. |
| 85 | * @param requestedOrientation An orientation constant as used in |
| 86 | * {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}. |
| 87 | * @param callback is the callback to be invoked if and when the view |
| 88 | * is dismissed. |
Kristian Monsen | 0e0b2da | 2013-04-10 13:43:43 -0700 | [diff] [blame] | 89 | * @deprecated This method supports the obsolete plugin mechanism, |
| 90 | * and will not be invoked in future |
Derek Sollenberger | 7ab3d67 | 2011-06-01 14:45:05 -0400 | [diff] [blame] | 91 | */ |
Kristian Monsen | 0e0b2da | 2013-04-10 13:43:43 -0700 | [diff] [blame] | 92 | @Deprecated |
Derek Sollenberger | 7ab3d67 | 2011-06-01 14:45:05 -0400 | [diff] [blame] | 93 | public void onShowCustomView(View view, int requestedOrientation, |
| 94 | CustomViewCallback callback) {}; |
| 95 | |
| 96 | /** |
| 97 | * Notify the host application that the current page would |
Andrei Popescu | 6fa2958 | 2009-06-19 14:54:09 +0100 | [diff] [blame] | 98 | * like to hide its custom view. |
Andrei Popescu | 6fa2958 | 2009-06-19 14:54:09 +0100 | [diff] [blame] | 99 | */ |
| 100 | public void onHideCustomView() {} |
| 101 | |
| 102 | /** |
Steve Block | 89e00a9 | 2011-08-03 15:24:43 +0100 | [diff] [blame] | 103 | * Request the host application to create a new window. If the host |
| 104 | * application chooses to honor this request, it should return true from |
| 105 | * this method, create a new WebView to host the window, insert it into the |
| 106 | * View system and send the supplied resultMsg message to its target with |
| 107 | * the new WebView as an argument. If the host application chooses not to |
| 108 | * honor the request, it should return false from this method. The default |
| 109 | * implementation of this method does nothing and hence returns false. |
| 110 | * @param view The WebView from which the request for a new window |
| 111 | * originated. |
| 112 | * @param isDialog True if the new window should be a dialog, rather than |
| 113 | * a full-size window. |
| 114 | * @param isUserGesture True if the request was initiated by a user gesture, |
| 115 | * such as the user clicking a link. |
| 116 | * @param resultMsg The message to send when once a new WebView has been |
| 117 | * created. resultMsg.obj is a |
Steve Block | b22a69f | 2011-10-17 11:55:37 +0100 | [diff] [blame] | 118 | * {@link WebView.WebViewTransport} object. This should be |
| 119 | * used to transport the new WebView, by calling |
| 120 | * {@link WebView.WebViewTransport#setWebView(WebView) |
| 121 | * WebView.WebViewTransport.setWebView(WebView)}. |
Steve Block | 89e00a9 | 2011-08-03 15:24:43 +0100 | [diff] [blame] | 122 | * @return This method should return true if the host application will |
| 123 | * create a new window, in which case resultMsg should be sent to |
| 124 | * its target. Otherwise, this method should return false. Returning |
| 125 | * false from this method but also sending resultMsg will result in |
| 126 | * undefined behavior. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 127 | */ |
Steve Block | 89e00a9 | 2011-08-03 15:24:43 +0100 | [diff] [blame] | 128 | public boolean onCreateWindow(WebView view, boolean isDialog, |
| 129 | boolean isUserGesture, Message resultMsg) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 130 | return false; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Request display and focus for this WebView. This may happen due to |
| 135 | * another WebView opening a link in this WebView and requesting that this |
| 136 | * WebView be displayed. |
| 137 | * @param view The WebView that needs to be focused. |
| 138 | */ |
| 139 | public void onRequestFocus(WebView view) {} |
| 140 | |
| 141 | /** |
| 142 | * Notify the host application to close the given WebView and remove it |
| 143 | * from the view system if necessary. At this point, WebCore has stopped |
| 144 | * any loading in this window and has removed any cross-scripting ability |
| 145 | * in javascript. |
| 146 | * @param window The WebView that needs to be closed. |
| 147 | */ |
| 148 | public void onCloseWindow(WebView window) {} |
| 149 | |
| 150 | /** |
| 151 | * Tell the client to display a javascript alert dialog. If the client |
| 152 | * returns true, WebView will assume that the client will handle the |
| 153 | * dialog. If the client returns false, it will continue execution. |
| 154 | * @param view The WebView that initiated the callback. |
| 155 | * @param url The url of the page requesting the dialog. |
| 156 | * @param message Message to be displayed in the window. |
| 157 | * @param result A JsResult to confirm that the user hit enter. |
| 158 | * @return boolean Whether the client will handle the alert dialog. |
| 159 | */ |
| 160 | public boolean onJsAlert(WebView view, String url, String message, |
| 161 | JsResult result) { |
| 162 | return false; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Tell the client to display a confirm dialog to the user. If the client |
| 167 | * returns true, WebView will assume that the client will handle the |
| 168 | * confirm dialog and call the appropriate JsResult method. If the |
| 169 | * client returns false, a default value of false will be returned to |
| 170 | * javascript. The default behavior is to return false. |
| 171 | * @param view The WebView that initiated the callback. |
| 172 | * @param url The url of the page requesting the dialog. |
| 173 | * @param message Message to be displayed in the window. |
| 174 | * @param result A JsResult used to send the user's response to |
| 175 | * javascript. |
| 176 | * @return boolean Whether the client will handle the confirm dialog. |
| 177 | */ |
| 178 | public boolean onJsConfirm(WebView view, String url, String message, |
| 179 | JsResult result) { |
| 180 | return false; |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Tell the client to display a prompt dialog to the user. If the client |
| 185 | * returns true, WebView will assume that the client will handle the |
| 186 | * prompt dialog and call the appropriate JsPromptResult method. If the |
| 187 | * client returns false, a default value of false will be returned to to |
| 188 | * javascript. The default behavior is to return false. |
| 189 | * @param view The WebView that initiated the callback. |
| 190 | * @param url The url of the page requesting the dialog. |
| 191 | * @param message Message to be displayed in the window. |
| 192 | * @param defaultValue The default value displayed in the prompt dialog. |
| 193 | * @param result A JsPromptResult used to send the user's reponse to |
| 194 | * javascript. |
| 195 | * @return boolean Whether the client will handle the prompt dialog. |
| 196 | */ |
| 197 | public boolean onJsPrompt(WebView view, String url, String message, |
| 198 | String defaultValue, JsPromptResult result) { |
| 199 | return false; |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Tell the client to display a dialog to confirm navigation away from the |
| 204 | * current page. This is the result of the onbeforeunload javascript event. |
| 205 | * If the client returns true, WebView will assume that the client will |
| 206 | * handle the confirm dialog and call the appropriate JsResult method. If |
| 207 | * the client returns false, a default value of true will be returned to |
| 208 | * javascript to accept navigation away from the current page. The default |
| 209 | * behavior is to return false. Setting the JsResult to true will navigate |
| 210 | * away from the current page, false will cancel the navigation. |
| 211 | * @param view The WebView that initiated the callback. |
| 212 | * @param url The url of the page requesting the dialog. |
| 213 | * @param message Message to be displayed in the window. |
| 214 | * @param result A JsResult used to send the user's response to |
| 215 | * javascript. |
| 216 | * @return boolean Whether the client will handle the confirm dialog. |
| 217 | */ |
| 218 | public boolean onJsBeforeUnload(WebView view, String url, String message, |
| 219 | JsResult result) { |
| 220 | return false; |
| 221 | } |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 222 | |
| 223 | /** |
Steve Block | 285ddfc | 2012-03-28 12:46:02 +0100 | [diff] [blame] | 224 | * Tell the client that the quota has been exceeded for the Web SQL Database |
| 225 | * API for a particular origin and request a new quota. The client must |
| 226 | * respond by invoking the |
| 227 | * {@link WebStorage.QuotaUpdater#updateQuota(long) updateQuota(long)} |
| 228 | * method of the supplied {@link WebStorage.QuotaUpdater} instance. The |
| 229 | * minimum value that can be set for the new quota is the current quota. The |
| 230 | * default implementation responds with the current quota, so the quota will |
| 231 | * not be increased. |
| 232 | * @param url The URL of the page that triggered the notification |
| 233 | * @param databaseIdentifier The identifier of the database where the quota |
| 234 | * was exceeded. |
| 235 | * @param quota The quota for the origin, in bytes |
| 236 | * @param estimatedDatabaseSize The estimated size of the offending |
| 237 | * database, in bytes |
| 238 | * @param totalQuota The total quota for all origins, in bytes |
| 239 | * @param quotaUpdater An instance of {@link WebStorage.QuotaUpdater} which |
| 240 | * must be used to inform the WebView of the new quota. |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 241 | * @deprecated This method is no longer called; WebView now uses the HTML5 / JavaScript Quota |
| 242 | * Management API. |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 243 | */ |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 244 | @Deprecated |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 245 | public void onExceededDatabaseQuota(String url, String databaseIdentifier, |
Steve Block | 285ddfc | 2012-03-28 12:46:02 +0100 | [diff] [blame] | 246 | long quota, long estimatedDatabaseSize, long totalQuota, |
| 247 | WebStorage.QuotaUpdater quotaUpdater) { |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 248 | // This default implementation passes the current quota back to WebCore. |
| 249 | // WebCore will interpret this that new quota was declined. |
Steve Block | 285ddfc | 2012-03-28 12:46:02 +0100 | [diff] [blame] | 250 | quotaUpdater.updateQuota(quota); |
Ben Murdoch | 7df1985 | 2009-04-22 13:07:58 +0100 | [diff] [blame] | 251 | } |
Guang Zhu | 10e4d20 | 2009-05-11 18:09:51 -0700 | [diff] [blame] | 252 | |
Andrei Popescu | 59e2ad9 | 2009-07-28 13:38:06 +0100 | [diff] [blame] | 253 | /** |
Selim Gurun | c86bec9 | 2012-06-28 16:47:19 -0700 | [diff] [blame] | 254 | * Notify the host application that the Application Cache has reached the |
| 255 | * maximum size. The client must respond by invoking the |
Steve Block | 285ddfc | 2012-03-28 12:46:02 +0100 | [diff] [blame] | 256 | * {@link WebStorage.QuotaUpdater#updateQuota(long) updateQuota(long)} |
| 257 | * method of the supplied {@link WebStorage.QuotaUpdater} instance. The |
| 258 | * minimum value that can be set for the new quota is the current quota. The |
| 259 | * default implementation responds with the current quota, so the quota will |
| 260 | * not be increased. |
| 261 | * @param requiredStorage The amount of storage required by the Application |
| 262 | * Cache operation that triggered this notification, |
| 263 | * in bytes. |
Selim Gurun | c86bec9 | 2012-06-28 16:47:19 -0700 | [diff] [blame] | 264 | * @param quota the current maximum Application Cache size, in bytes |
Steve Block | 285ddfc | 2012-03-28 12:46:02 +0100 | [diff] [blame] | 265 | * @param quotaUpdater An instance of {@link WebStorage.QuotaUpdater} which |
| 266 | * must be used to inform the WebView of the new quota. |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 267 | * @deprecated This method is no longer called; WebView now uses the HTML5 / JavaScript Quota |
| 268 | * Management API. |
Andrei Popescu | 59e2ad9 | 2009-07-28 13:38:06 +0100 | [diff] [blame] | 269 | */ |
Jonathan Dixon | 5545d08 | 2013-08-31 22:43:11 -0700 | [diff] [blame] | 270 | @Deprecated |
Steve Block | 285ddfc | 2012-03-28 12:46:02 +0100 | [diff] [blame] | 271 | public void onReachedMaxAppCacheSize(long requiredStorage, long quota, |
Andrei Popescu | 59e2ad9 | 2009-07-28 13:38:06 +0100 | [diff] [blame] | 272 | WebStorage.QuotaUpdater quotaUpdater) { |
Steve Block | 285ddfc | 2012-03-28 12:46:02 +0100 | [diff] [blame] | 273 | quotaUpdater.updateQuota(quota); |
Andrei Popescu | 59e2ad9 | 2009-07-28 13:38:06 +0100 | [diff] [blame] | 274 | } |
| 275 | |
Guang Zhu | 81e4143 | 2009-05-08 16:09:55 -0700 | [diff] [blame] | 276 | /** |
Steve Block | 7351adf | 2011-11-30 15:52:32 +0000 | [diff] [blame] | 277 | * Notify the host application that web content from the specified origin |
| 278 | * is attempting to use the Geolocation API, but no permission state is |
| 279 | * currently set for that origin. The host application should invoke the |
| 280 | * specified callback with the desired permission state. See |
| 281 | * {@link GeolocationPermissions} for details. |
| 282 | * @param origin The origin of the web content attempting to use the |
| 283 | * Geolocation API. |
| 284 | * @param callback The callback to use to set the permission state for the |
| 285 | * origin. |
Steve Block | 4faee09 | 2009-07-28 18:20:50 +0100 | [diff] [blame] | 286 | */ |
| 287 | public void onGeolocationPermissionsShowPrompt(String origin, |
| 288 | GeolocationPermissions.Callback callback) {} |
| 289 | |
| 290 | /** |
Steve Block | 7351adf | 2011-11-30 15:52:32 +0000 | [diff] [blame] | 291 | * Notify the host application that a request for Geolocation permissions, |
| 292 | * made with a previous call to |
| 293 | * {@link #onGeolocationPermissionsShowPrompt(String,GeolocationPermissions.Callback) onGeolocationPermissionsShowPrompt()} |
| 294 | * has been canceled. Any related UI should therefore be hidden. |
Steve Block | 4faee09 | 2009-07-28 18:20:50 +0100 | [diff] [blame] | 295 | */ |
| 296 | public void onGeolocationPermissionsHidePrompt() {} |
| 297 | |
| 298 | /** |
Tao Bai | 4c22b54 | 2014-04-15 18:04:49 +0000 | [diff] [blame] | 299 | * Notify the host application that web content is requesting permission to |
| 300 | * access the specified resources and the permission currently isn't granted |
| 301 | * or denied. The host application must invoke {@link PermissionRequest#grant(long)} |
| 302 | * or {@link PermissionRequest#deny()}. |
| 303 | * |
| 304 | * If this method isn't overridden, the permission is denied. |
| 305 | * |
| 306 | * @param request the PermissionRequest from current web content. |
Tao Bai | 4c22b54 | 2014-04-15 18:04:49 +0000 | [diff] [blame] | 307 | */ |
| 308 | public void onPermissionRequest(PermissionRequest request) { |
| 309 | request.deny(); |
| 310 | } |
| 311 | |
| 312 | /** |
| 313 | * Notify the host application that the given permission request |
| 314 | * has been canceled. Any related UI should therefore be hidden. |
| 315 | * |
Tao Bai | fa1fd2c | 2014-04-30 13:31:34 -0700 | [diff] [blame^] | 316 | * @param request the PermissionRequest that needs be canceled. |
Tao Bai | 4c22b54 | 2014-04-15 18:04:49 +0000 | [diff] [blame] | 317 | */ |
| 318 | public void onPermissionRequestCanceled(PermissionRequest request) {} |
| 319 | |
| 320 | /** |
Guang Zhu | 81e4143 | 2009-05-08 16:09:55 -0700 | [diff] [blame] | 321 | * Tell the client that a JavaScript execution timeout has occured. And the |
| 322 | * client may decide whether or not to interrupt the execution. If the |
| 323 | * client returns true, the JavaScript will be interrupted. If the client |
| 324 | * returns false, the execution will continue. Note that in the case of |
| 325 | * continuing execution, the timeout counter will be reset, and the callback |
| 326 | * will continue to occur if the script does not finish at the next check |
| 327 | * point. |
| 328 | * @return boolean Whether the JavaScript execution should be interrupted. |
Ben Murdoch | 1bd37b1 | 2012-05-28 12:42:39 +0100 | [diff] [blame] | 329 | * @deprecated This method is no longer supported and will not be invoked. |
Guang Zhu | 81e4143 | 2009-05-08 16:09:55 -0700 | [diff] [blame] | 330 | */ |
Ben Murdoch | 1bd37b1 | 2012-05-28 12:42:39 +0100 | [diff] [blame] | 331 | // This method was only called when using the JSC javascript engine. V8 became |
| 332 | // the default JS engine with Froyo and support for building with JSC was |
| 333 | // removed in b/5495373. V8 does not have a mechanism for making a callback such |
| 334 | // as this. |
Guang Zhu | 81e4143 | 2009-05-08 16:09:55 -0700 | [diff] [blame] | 335 | public boolean onJsTimeout() { |
| 336 | return true; |
| 337 | } |
Ben Murdoch | 6262ae5 | 2009-04-17 13:21:53 +0100 | [diff] [blame] | 338 | |
| 339 | /** |
Ben Murdoch | 7caaeec | 2009-11-19 18:14:53 +0000 | [diff] [blame] | 340 | * Report a JavaScript error message to the host application. The ChromeClient |
| 341 | * should override this to process the log message as they see fit. |
Ben Murdoch | 6262ae5 | 2009-04-17 13:21:53 +0100 | [diff] [blame] | 342 | * @param message The error message to report. |
| 343 | * @param lineNumber The line number of the error. |
| 344 | * @param sourceID The name of the source file that caused the error. |
Ben Murdoch | 3141e0a | 2010-01-28 15:06:32 +0000 | [diff] [blame] | 345 | * @deprecated Use {@link #onConsoleMessage(ConsoleMessage) onConsoleMessage(ConsoleMessage)} |
| 346 | * instead. |
Ben Murdoch | 6262ae5 | 2009-04-17 13:21:53 +0100 | [diff] [blame] | 347 | */ |
Ben Murdoch | 3141e0a | 2010-01-28 15:06:32 +0000 | [diff] [blame] | 348 | @Deprecated |
| 349 | public void onConsoleMessage(String message, int lineNumber, String sourceID) { } |
| 350 | |
| 351 | /** |
| 352 | * Report a JavaScript console message to the host application. The ChromeClient |
| 353 | * should override this to process the log message as they see fit. |
| 354 | * @param consoleMessage Object containing details of the console message. |
| 355 | * @return true if the message is handled by the client. |
| 356 | */ |
| 357 | public boolean onConsoleMessage(ConsoleMessage consoleMessage) { |
| 358 | // Call the old version of this function for backwards compatability. |
| 359 | onConsoleMessage(consoleMessage.message(), consoleMessage.lineNumber(), |
| 360 | consoleMessage.sourceId()); |
| 361 | return false; |
| 362 | } |
Andrei Popescu | bf385d7 | 2009-09-18 18:59:52 +0100 | [diff] [blame] | 363 | |
| 364 | /** |
Ben Murdoch | f0c443d | 2009-11-19 16:43:58 +0000 | [diff] [blame] | 365 | * When not playing, video elements are represented by a 'poster' image. The |
| 366 | * image to use can be specified by the poster attribute of the video tag in |
| 367 | * HTML. If the attribute is absent, then a default poster will be used. This |
| 368 | * method allows the ChromeClient to provide that default image. |
Andrei Popescu | bf385d7 | 2009-09-18 18:59:52 +0100 | [diff] [blame] | 369 | * |
Ben Murdoch | f0c443d | 2009-11-19 16:43:58 +0000 | [diff] [blame] | 370 | * @return Bitmap The image to use as a default poster, or null if no such image is |
| 371 | * available. |
Andrei Popescu | bf385d7 | 2009-09-18 18:59:52 +0100 | [diff] [blame] | 372 | */ |
| 373 | public Bitmap getDefaultVideoPoster() { |
| 374 | return null; |
| 375 | } |
| 376 | |
| 377 | /** |
Ben Murdoch | f0c443d | 2009-11-19 16:43:58 +0000 | [diff] [blame] | 378 | * When the user starts to playback a video element, it may take time for enough |
| 379 | * data to be buffered before the first frames can be rendered. While this buffering |
| 380 | * is taking place, the ChromeClient can use this function to provide a View to be |
| 381 | * displayed. For example, the ChromeClient could show a spinner animation. |
Andrei Popescu | bf385d7 | 2009-09-18 18:59:52 +0100 | [diff] [blame] | 382 | * |
Ben Murdoch | f0c443d | 2009-11-19 16:43:58 +0000 | [diff] [blame] | 383 | * @return View The View to be displayed whilst the video is loading. |
Andrei Popescu | bf385d7 | 2009-09-18 18:59:52 +0100 | [diff] [blame] | 384 | */ |
| 385 | public View getVideoLoadingProgressView() { |
| 386 | return null; |
| 387 | } |
Leon Clarke | 194e345 | 2009-09-28 11:42:12 +0100 | [diff] [blame] | 388 | |
| 389 | /** Obtains a list of all visited history items, used for link coloring |
Leon Clarke | 194e345 | 2009-09-28 11:42:12 +0100 | [diff] [blame] | 390 | */ |
| 391 | public void getVisitedHistory(ValueCallback<String[]> callback) { |
| 392 | } |
| 393 | |
Leon Scroggins | 70ca3c2 | 2009-10-02 15:58:55 -0400 | [diff] [blame] | 394 | /** |
| 395 | * Tell the client to open a file chooser. |
| 396 | * @param uploadFile A ValueCallback to set the URI of the file to upload. |
Ben Murdoch | 4ae32f5 | 2010-05-18 14:30:39 +0100 | [diff] [blame] | 397 | * onReceiveValue must be called to wake up the thread.a |
| 398 | * @param acceptType The value of the 'accept' attribute of the input tag |
| 399 | * associated with this file picker. |
Ben Murdoch | be71692 | 2012-01-11 10:55:10 +0000 | [diff] [blame] | 400 | * @param capture The value of the 'capture' attribute of the input tag |
| 401 | * associated with this file picker. |
Leon Scroggins | 70ca3c2 | 2009-10-02 15:58:55 -0400 | [diff] [blame] | 402 | * @hide |
| 403 | */ |
Ben Murdoch | be71692 | 2012-01-11 10:55:10 +0000 | [diff] [blame] | 404 | public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType, String capture) { |
Leon Scroggins | 70ca3c2 | 2009-10-02 15:58:55 -0400 | [diff] [blame] | 405 | uploadFile.onReceiveValue(null); |
| 406 | } |
Cary Clark | 924af70 | 2010-06-04 16:37:43 -0400 | [diff] [blame] | 407 | |
| 408 | /** |
Ben Murdoch | 5791438 | 2010-11-16 11:50:39 +0000 | [diff] [blame] | 409 | * Tell the client that the page being viewed has an autofillable |
| 410 | * form and the user would like to set a profile up. |
| 411 | * @param msg A Message to send once the user has successfully |
| 412 | * set up a profile and to inform the WebTextView it should |
| 413 | * now autofill using that new profile. |
| 414 | * @hide |
| 415 | */ |
| 416 | public void setupAutoFill(Message msg) { } |
| 417 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 418 | } |