WebViewClient.java revision a8352f40316fb265c74d42e908eb30284259b47d
19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/* 29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project 39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * you may not use this file except in compliance with the License. 69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * You may obtain a copy of the License at 79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * 109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Unless required by applicable law or agreed to in writing, software 119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * See the License for the specific language governing permissions and 149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * limitations under the License. 159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpackage android.webkit; 189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.graphics.Bitmap; 209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.net.http.SslError; 219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.Message; 22899d70568b565280dd33fa8892e25c5511f95769Michael Wrightimport android.view.InputEvent; 239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.view.KeyEvent; 24d6b1098e1f46530528dfea415655468ec994bbb6John Reckimport android.view.ViewRootImpl; 259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpublic class WebViewClient { 279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Give the host application a chance to take over the control when a new 309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * url is about to be loaded in the current WebView. If WebViewClient is not 319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * provided, by default WebView will ask Activity Manager to choose the 329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * proper handler for the url. If WebViewClient is provided, return true 339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * means the host application handles the url, while return false means the 349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * current WebView handles the url. 35881c49c99be006f90a51a444db6b96289947e73aMartin Kosiba * This method is not called for requests using the POST "method". 36a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param url The url to be loaded. 399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @return True if the host application wants to leave the current WebView 409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * and handle the url itself, otherwise return false. 419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public boolean shouldOverrideUrlLoading(WebView view, String url) { 439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project return false; 449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Notify the host application that a page has started loading. This method 489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * is called once for each main frame load so a page with iframes or 499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * framesets will call onPageStarted one time for the main frame. This also 509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * means that onPageStarted will not be called when the contents of an 5116687cc956af678032f03e1c9ec5ee51736bc763Marcin Kosiba * embedded frame changes, i.e. clicking a link whose target is an iframe, 5216687cc956af678032f03e1c9ec5ee51736bc763Marcin Kosiba * it will also not be called for fragment navigations (navigations to 5316687cc956af678032f03e1c9ec5ee51736bc763Marcin Kosiba * #fragment_id). 54a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param url The url to be loaded. 579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param favicon The favicon for this page if it already exists in the 589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * database. 599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onPageStarted(WebView view, String url, Bitmap favicon) { 619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Notify the host application that a page has finished loading. This method 659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * is called only for main frame. When onPageFinished() is called, the 669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * rendering picture may not be updated yet. To get the notification for the 679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * new Picture, use {@link WebView.PictureListener#onNewPicture}. 68a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param url The url of the page. 719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onPageFinished(WebView view, String url) { 739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Notify the host application that the WebView will load the resource 779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * specified by the given url. 78a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param url The url of the resource the WebView will load. 819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onLoadResource(WebView view, String url) { 839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 86a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * Notify the host application that the page commit is visible. 87a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * 88a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * <p>This is the earliest point at which we can guarantee that the contents of the previously 89a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * loaded page will not longer be drawn in the next {@link WebView#onDraw}. The next draw will 90a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * render the {@link WebView#setBackgroundColor background color} of the WebView or some of the 91a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * contents from the committed page already. This callback may be useful when reusing 92a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * {@link WebView}s to ensure that no stale content is shown. This method is only called for 93a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * the main frame.</p> 94a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * 95a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * <p>This method is called when the state of the DOM at the point at which the 96a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * body of the HTTP response (commonly the string of html) had started loading will be visible. 97a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * If you set a background color for the page in the HTTP response body this will most likely 98a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * be visible and perhaps some other elements. At that point no other resources had usually 99a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * been loaded, so you can expect images for example to not be visible. If you want 100a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * a finer level of granularity consider calling {@link WebView#insertVisualStateCallback} 101a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * directly.</p> 102a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * 103a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * <p>Please note that all the conditions and recommendations presented in 104a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * {@link WebView#insertVisualStateCallback} also apply to this API.<p> 105a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * 106a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant * @param url the url of the committed page 107a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant */ 108a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant public void onPageCommitVisible(WebView view, String url) { 109a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant } 110a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant 111a8352f40316fb265c74d42e908eb30284259b47dTobias Sargeant /** 112c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * Notify the host application of a resource request and allow the 113c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * application to return the data. If the return value is null, the WebView 114c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * will continue to load the resource as usual. Otherwise, the return 11515cb82549375d89feb1cf0f2825e3e31a94d0c38Martin Kosiba * response and data will be used. NOTE: This method is called on a thread 11615cb82549375d89feb1cf0f2825e3e31a94d0c38Martin Kosiba * other than the UI thread so clients should exercise caution 11715cb82549375d89feb1cf0f2825e3e31a94d0c38Martin Kosiba * when accessing private data or the view system. 118c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * 119c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * @param view The {@link android.webkit.WebView} that is requesting the 120c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * resource. 121c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * @param url The raw url of the resource. 122c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * @return A {@link android.webkit.WebResourceResponse} containing the 123c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * response information or null if the WebView should load the 124c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott * resource itself. 125d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * @deprecated Use {@link #shouldInterceptRequest(WebView, WebResourceRequest) 126d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * shouldInterceptRequest(WebView, WebResourceRequest)} instead. 127c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott */ 128d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba @Deprecated 129c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott public WebResourceResponse shouldInterceptRequest(WebView view, 130c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott String url) { 131c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott return null; 132c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott } 133c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott 134c12544a201667383bc3dfb4bd3ad62d98cacd24fPatrick Scott /** 135d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * Notify the host application of a resource request and allow the 136d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * application to return the data. If the return value is null, the WebView 137d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * will continue to load the resource as usual. Otherwise, the return 138d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * response and data will be used. NOTE: This method is called on a thread 139d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * other than the UI thread so clients should exercise caution 140d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * when accessing private data or the view system. 141d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * 142d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * @param view The {@link android.webkit.WebView} that is requesting the 143d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * resource. 144d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * @param request Object containing the details of the request. 145d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * @return A {@link android.webkit.WebResourceResponse} containing the 146d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * response information or null if the WebView should load the 147d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba * resource itself. 148d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba */ 149d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba public WebResourceResponse shouldInterceptRequest(WebView view, 150d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba WebResourceRequest request) { 151d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba return shouldInterceptRequest(view, request.getUrl().toString()); 152d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba } 153d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba 154d72e7ba1c04b2f7b128c5710607a72867b73bf1cMarcin Kosiba /** 1559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Notify the host application that there have been an excessive number of 1569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * HTTP redirects. As the host application if it would like to continue 1579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * trying to load the resource. The default behavior is to send the cancel 1589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * message. 159a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 1609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 1619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param cancelMsg The message to send if the host wants to cancel 1629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param continueMsg The message to send if the host wants to continue 1636a5b0ecae5dc89a951e1e204bc007f50f944c5d1Patrick Scott * @deprecated This method is no longer called. When the WebView encounters 1646a5b0ecae5dc89a951e1e204bc007f50f944c5d1Patrick Scott * a redirect loop, it will cancel the load. 1659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 166b5503c168a49f0f2b1372678f87d874e7d82aaadKristian Monsen @Deprecated 1679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onTooManyRedirects(WebView view, Message cancelMsg, 1689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project Message continueMsg) { 1699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project cancelMsg.sendToTarget(); 1709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 1719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 17205c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott // These ints must match up to the hidden values in EventHandler. 17305c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Generic error */ 17405c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_UNKNOWN = -1; 17505c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Server or proxy hostname lookup failed */ 17605c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_HOST_LOOKUP = -2; 17705c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Unsupported authentication scheme (not basic or digest) */ 17805c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_UNSUPPORTED_AUTH_SCHEME = -3; 17905c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** User authentication failed on server */ 18005c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_AUTHENTICATION = -4; 18105c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** User authentication failed on proxy */ 18205c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_PROXY_AUTHENTICATION = -5; 18305c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Failed to connect to the server */ 18405c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_CONNECT = -6; 18505c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Failed to read or write to the server */ 18605c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_IO = -7; 18705c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Connection timed out */ 18805c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_TIMEOUT = -8; 18905c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Too many redirects */ 19005c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_REDIRECT_LOOP = -9; 19105c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Unsupported URI scheme */ 19205c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_UNSUPPORTED_SCHEME = -10; 19305c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Failed to perform SSL handshake */ 19405c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_FAILED_SSL_HANDSHAKE = -11; 19505c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Malformed URL */ 19605c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_BAD_URL = -12; 19705c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Generic file error */ 19805c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_FILE = -13; 19905c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** File not found */ 20005c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_FILE_NOT_FOUND = -14; 20105c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott /** Too many requests during this load */ 20205c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott public static final int ERROR_TOO_MANY_REQUESTS = -15; 20325e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov /** Request blocked by the browser */ 20425e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov public static final int ERROR_BLOCKED = -16; 20505c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott 2069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 20705c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott * Report an error to the host application. These errors are unrecoverable 20805c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott * (i.e. the main resource is unavailable). The errorCode parameter 20905c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott * corresponds to one of the ERROR_* constants. 2109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 211447811c64f60d29a5c0bf2d7ba94b91c68fe2612Patrick Scott * @param errorCode The error code corresponding to an ERROR_* value. 21205c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott * @param description A String describing the error. 21305c9ed9ce1d920c322ee1431cfed64541f0acf3cPatrick Scott * @param failingUrl The url that failed to load. 21425e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * @deprecated Use {@link #onReceivedError(WebView, WebResourceRequest, WebResourceError) 21525e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * onReceivedError(WebView, WebResourceRequest, WebResourceError)} instead. 2169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 21725e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov @Deprecated 2189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onReceivedError(WebView view, int errorCode, 2199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project String description, String failingUrl) { 2209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 2229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 22325e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * Report web resource loading error to the host application. These errors usually indicate 22425e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * inability to connect to the server. Note that unlike the deprecated version of the callback, 22525e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * the new version will be called for any resource (iframe, image, etc), not just for the main 22625e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * page. Thus, it is recommended to perform minimum required work in this callback. 22725e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * @param view The WebView that is initiating the callback. 22825e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * @param request The originating request. 22925e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * @param error Information about the error occured. 23025e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov */ 23125e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { 23225e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov if (request.isForMainFrame()) { 23325e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov onReceivedError(view, 23425e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov error.getErrorCode(), error.getDescription(), request.getUrl().toString()); 23525e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov } 23625e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov } 23725e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov 23825e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov /** 23925e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * Notify the host application that an HTTP error has been received from the server while 24025e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * loading a resource. HTTP errors have status codes >= 400. This callback will be called 24125e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * for any resource (iframe, image, etc), not just for the main page. Thus, it is recommended to 24225e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * perform minimum required work in this callback. Note that the content of the server 24325e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * response may not be provided within the <b>errorResponse</b> parameter. 24425e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * @param view The WebView that is initiating the callback. 24525e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * @param request The originating request. 24625e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov * @param errorResponse Information about the error occured. 24725e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov */ 24825e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov public void onReceivedHttpError( 24925e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov WebView view, WebResourceRequest request, WebResourceResponseBase errorResponse) { 25025e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov } 25125e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov 25225e89545736d62c59d19dd9b9587f7b0cbbee068Mikhail Naganov /** 2539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * As the host application if the browser should resend data as the 2549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * requested page was a result of a POST. The default is to not resend the 2559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * data. 256a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 2579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 2589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param dontResend The message to send if the browser should not resend 2599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param resend The message to send if the browser should resend data 2609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 2619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onFormResubmission(WebView view, Message dontResend, 2629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project Message resend) { 2639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project dontResend.sendToTarget(); 2649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 2669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 2679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Notify the host application to update its visited links database. 268a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 2699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 2709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param url The url being visited. 2719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param isReload True if this url is being reloaded. 2729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 2739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void doUpdateVisitedHistory(WebView view, String url, 2749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project boolean isReload) { 2759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 2769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 2779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 278fe33a75cc8883dc5d50dd5a2fb0eac702f2a6992Steve Block * Notify the host application that an SSL error occurred while loading a 279fe33a75cc8883dc5d50dd5a2fb0eac702f2a6992Steve Block * resource. The host application must call either handler.cancel() or 280fe33a75cc8883dc5d50dd5a2fb0eac702f2a6992Steve Block * handler.proceed(). Note that the decision may be retained for use in 281fe33a75cc8883dc5d50dd5a2fb0eac702f2a6992Steve Block * response to future SSL errors. The default behavior is to cancel the 282fe33a75cc8883dc5d50dd5a2fb0eac702f2a6992Steve Block * load. 283a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 2849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 2859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param handler An SslErrorHandler object that will handle the user's 2869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * response. 2879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param error The SSL error object. 2889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 2899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onReceivedSslError(WebView view, SslErrorHandler handler, 2909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project SslError error) { 2919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project handler.cancel(); 292a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom } 293a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom 294a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom /** 295b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * Notify the host application to handle a SSL client certificate 296b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * request. The host application is responsible for showing the UI 297b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * if desired and providing the keys. There are three ways to 298b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * respond: proceed(), cancel() or ignore(). Webview remembers the 299b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * response if proceed() or cancel() is called and does not 300b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * call onReceivedClientCertRequest() again for the same host and port 301b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * pair. Webview does not remember the response if ignore() is called. 302b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * 303b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * This method is called on the UI thread. During the callback, the 304b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * connection is suspended. 305b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * 306b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * The default behavior is to cancel, returning no client certificate. 307b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * 308b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * @param view The WebView that is initiating the callback 309b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * @param request An instance of a {@link ClientCertRequest} 310b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun * 311b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun */ 312b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun public void onReceivedClientCertRequest(WebView view, ClientCertRequest request) { 313b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun request.cancel(); 314b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun } 315b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun 316b6aa97e0a0cd13846c148716fc0c7947422cea04Selim Gurun /** 31746ce1db6ff3290b82b12f11715fbe82734a44322Steve Block * Notifies the host application that the WebView received an HTTP 31846ce1db6ff3290b82b12f11715fbe82734a44322Steve Block * authentication request. The host application can use the supplied 31946ce1db6ff3290b82b12f11715fbe82734a44322Steve Block * {@link HttpAuthHandler} to set the WebView's response to the request. 32046ce1db6ff3290b82b12f11715fbe82734a44322Steve Block * The default behavior is to cancel the request. 321a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 32246ce1db6ff3290b82b12f11715fbe82734a44322Steve Block * @param view the WebView that is initiating the callback 32346ce1db6ff3290b82b12f11715fbe82734a44322Steve Block * @param handler the HttpAuthHandler used to set the WebView's response 32446ce1db6ff3290b82b12f11715fbe82734a44322Steve Block * @param host the host requiring authentication 32546ce1db6ff3290b82b12f11715fbe82734a44322Steve Block * @param realm the realm for which authentication is required 32647aaba3faf5c950e1d7b2c613fe8e2c73c6748a7Jonathan Dixon * @see WebView#getHttpAuthUsernamePassword 3279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 3289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onReceivedHttpAuthRequest(WebView view, 3299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project HttpAuthHandler handler, String host, String realm) { 3309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project handler.cancel(); 3319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 3329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 3339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 3349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Give the host application a chance to handle the key event synchronously. 3359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * e.g. menu shortcut key events need to be filtered this way. If return 3369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * true, WebView will not handle the key event. If return false, WebView 3379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * will always handle the key event, so none of the super in the view chain 3389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * will see the key event. The default behavior returns false. 339a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 3409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 3419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param event The key event. 3429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @return True if the host application wants to handle the key event 3439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * itself, otherwise return false 3449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 3459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event) { 3469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project return false; 3479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 3489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 3499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 3509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Notify the host application that a key was not handled by the WebView. 3519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Except system keys, WebView always consumes the keys in the normal flow 3529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * or if shouldOverrideKeyEvent returns true. This is called asynchronously 353f76a50ce8fdc6aea22cabc77b2977a1a15a79630Ken Wakasa * from where the key is dispatched. It gives the host application a chance 3549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * to handle the unhandled key events. 355a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 3569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view The WebView that is initiating the callback. 3579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param event The key event. 358899d70568b565280dd33fa8892e25c5511f95769Michael Wright * @deprecated This method is subsumed by the more generic onUnhandledInputEvent. 3599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 360899d70568b565280dd33fa8892e25c5511f95769Michael Wright @Deprecated 3619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onUnhandledKeyEvent(WebView view, KeyEvent event) { 362899d70568b565280dd33fa8892e25c5511f95769Michael Wright onUnhandledInputEventInternal(view, event); 363899d70568b565280dd33fa8892e25c5511f95769Michael Wright } 364899d70568b565280dd33fa8892e25c5511f95769Michael Wright 365899d70568b565280dd33fa8892e25c5511f95769Michael Wright /** 366899d70568b565280dd33fa8892e25c5511f95769Michael Wright * Notify the host application that a input event was not handled by the WebView. 367899d70568b565280dd33fa8892e25c5511f95769Michael Wright * Except system keys, WebView always consumes input events in the normal flow 368899d70568b565280dd33fa8892e25c5511f95769Michael Wright * or if shouldOverrideKeyEvent returns true. This is called asynchronously 369899d70568b565280dd33fa8892e25c5511f95769Michael Wright * from where the event is dispatched. It gives the host application a chance 370899d70568b565280dd33fa8892e25c5511f95769Michael Wright * to handle the unhandled input events. 371899d70568b565280dd33fa8892e25c5511f95769Michael Wright * 3721feb11f511af25aa5d62d073d970071d16985661Michael Wright * Note that if the event is a {@link android.view.MotionEvent}, then it's lifetime is only 3731feb11f511af25aa5d62d073d970071d16985661Michael Wright * that of the function call. If the WebViewClient wishes to use the event beyond that, then it 3741feb11f511af25aa5d62d073d970071d16985661Michael Wright * <i>must</i> create a copy of the event. 375899d70568b565280dd33fa8892e25c5511f95769Michael Wright * 3761feb11f511af25aa5d62d073d970071d16985661Michael Wright * It is the responsibility of overriders of this method to call 3771feb11f511af25aa5d62d073d970071d16985661Michael Wright * {@link #onUnhandledKeyEvent(WebView, KeyEvent)} 378899d70568b565280dd33fa8892e25c5511f95769Michael Wright * when appropriate if they wish to continue receiving events through it. 379899d70568b565280dd33fa8892e25c5511f95769Michael Wright * 380899d70568b565280dd33fa8892e25c5511f95769Michael Wright * @param view The WebView that is initiating the callback. 381899d70568b565280dd33fa8892e25c5511f95769Michael Wright * @param event The input event. 382899d70568b565280dd33fa8892e25c5511f95769Michael Wright */ 383899d70568b565280dd33fa8892e25c5511f95769Michael Wright public void onUnhandledInputEvent(WebView view, InputEvent event) { 384899d70568b565280dd33fa8892e25c5511f95769Michael Wright if (event instanceof KeyEvent) { 385899d70568b565280dd33fa8892e25c5511f95769Michael Wright onUnhandledKeyEvent(view, (KeyEvent) event); 386899d70568b565280dd33fa8892e25c5511f95769Michael Wright return; 387899d70568b565280dd33fa8892e25c5511f95769Michael Wright } 388899d70568b565280dd33fa8892e25c5511f95769Michael Wright onUnhandledInputEventInternal(view, event); 389899d70568b565280dd33fa8892e25c5511f95769Michael Wright } 390899d70568b565280dd33fa8892e25c5511f95769Michael Wright 391899d70568b565280dd33fa8892e25c5511f95769Michael Wright private void onUnhandledInputEventInternal(WebView view, InputEvent event) { 392d6b1098e1f46530528dfea415655468ec994bbb6John Reck ViewRootImpl root = view.getViewRootImpl(); 393d6b1098e1f46530528dfea415655468ec994bbb6John Reck if (root != null) { 394899d70568b565280dd33fa8892e25c5511f95769Michael Wright root.dispatchUnhandledInputEvent(event); 395d6b1098e1f46530528dfea415655468ec994bbb6John Reck } 3969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 3979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project 3989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project /** 3999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Notify the host application that the scale applied to the WebView has 4009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * changed. 401a14775949c97a616196f5293209b092ee3d4e9a9Brian Carlstrom * 4029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param view he WebView that is initiating the callback. 4039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param oldScale The old scale factor 4049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * @param newScale The new scale factor 4059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */ 4069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project public void onScaleChanged(WebView view, float oldScale, float newScale) { 4079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project } 40885a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott 40985a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott /** 41085a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott * Notify the host application that a request to automatically log in the 41185a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott * user has been processed. 41285a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott * @param view The WebView requesting the login. 41385a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott * @param realm The account realm used to look up accounts. 41485a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott * @param account An optional account. If not null, the account should be 41585a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott * checked against accounts on the device. If it is a valid 41685a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott * account, it should be used to log in the user. 41785a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott * @param args Authenticator specific arguments used to log in the user. 41885a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott */ 41985a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott public void onReceivedLoginRequest(WebView view, String realm, 42085a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott String account, String args) { 42185a50ff48b2331913cc87f483eafba9f231c8c8cPatrick Scott } 4229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project} 423