18233facddcc51865d612a919d450db6954aa48e3Michael Kolb/* 28233facddcc51865d612a919d450db6954aa48e3Michael Kolb * Copyright (C) 2010 The Android Open Source Project 38233facddcc51865d612a919d450db6954aa48e3Michael Kolb * 48233facddcc51865d612a919d450db6954aa48e3Michael Kolb * Licensed under the Apache License, Version 2.0 (the "License"); 58233facddcc51865d612a919d450db6954aa48e3Michael Kolb * you may not use this file except in compliance with the License. 68233facddcc51865d612a919d450db6954aa48e3Michael Kolb * You may obtain a copy of the License at 78233facddcc51865d612a919d450db6954aa48e3Michael Kolb * 88233facddcc51865d612a919d450db6954aa48e3Michael Kolb * http://www.apache.org/licenses/LICENSE-2.0 98233facddcc51865d612a919d450db6954aa48e3Michael Kolb * 108233facddcc51865d612a919d450db6954aa48e3Michael Kolb * Unless required by applicable law or agreed to in writing, software 118233facddcc51865d612a919d450db6954aa48e3Michael Kolb * distributed under the License is distributed on an "AS IS" BASIS, 128233facddcc51865d612a919d450db6954aa48e3Michael Kolb * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138233facddcc51865d612a919d450db6954aa48e3Michael Kolb * See the License for the specific language governing permissions and 148233facddcc51865d612a919d450db6954aa48e3Michael Kolb * limitations under the License. 158233facddcc51865d612a919d450db6954aa48e3Michael Kolb */ 168233facddcc51865d612a919d450db6954aa48e3Michael Kolb 178233facddcc51865d612a919d450db6954aa48e3Michael Kolbpackage com.android.browser; 188233facddcc51865d612a919d450db6954aa48e3Michael Kolb 198233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.app.Activity; 201461244018a225006a8d4c203f9dfe294ffe94faMichael Kolbimport android.content.Context; 218233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.graphics.Bitmap; 228233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.net.Uri; 238233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.net.http.SslError; 248029a777106fa6fb911ee1d58402b0de768a583aBen Murdochimport android.os.Message; 258233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.view.KeyEvent; 268233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.view.View; 278233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.webkit.HttpAuthHandler; 288233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.webkit.SslErrorHandler; 298233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.webkit.ValueCallback; 308233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.webkit.WebChromeClient; 314d59434c396e3d414ed4266103d6990a340331e1Selim Gurunimport android.webkit.WebChromeClient.FileChooserParams; 328233facddcc51865d612a919d450db6954aa48e3Michael Kolbimport android.webkit.WebView; 338233facddcc51865d612a919d450db6954aa48e3Michael Kolb 3411d1978d8d16004598347abc93918b54a5ef760bMichael Kolbimport java.util.List; 3511d1978d8d16004598347abc93918b54a5ef760bMichael Kolb 368233facddcc51865d612a919d450db6954aa48e3Michael Kolb/** 378233facddcc51865d612a919d450db6954aa48e3Michael Kolb * WebView aspect of the controller 388233facddcc51865d612a919d450db6954aa48e3Michael Kolb */ 398233facddcc51865d612a919d450db6954aa48e3Michael Kolbpublic interface WebViewController { 408233facddcc51865d612a919d450db6954aa48e3Michael Kolb 411461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb Context getContext(); 421461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb 438233facddcc51865d612a919d450db6954aa48e3Michael Kolb Activity getActivity(); 448233facddcc51865d612a919d450db6954aa48e3Michael Kolb 458233facddcc51865d612a919d450db6954aa48e3Michael Kolb TabControl getTabControl(); 468233facddcc51865d612a919d450db6954aa48e3Michael Kolb 471514bb7ed5656316a8dac966cee21653f3c59affMichael Kolb WebViewFactory getWebViewFactory(); 481514bb7ed5656316a8dac966cee21653f3c59affMichael Kolb 49a713ec8cc9da6c0c8078cd297c6240eb8bf01bbbMichael Kolb void onSetWebView(Tab tab, WebView view); 50a713ec8cc9da6c0c8078cd297c6240eb8bf01bbbMichael Kolb 511514bb7ed5656316a8dac966cee21653f3c59affMichael Kolb void createSubWindow(Tab tab); 521514bb7ed5656316a8dac966cee21653f3c59affMichael Kolb 53324d440ea7dc44da8beef8a6c2e6f7a33b20a41dJohn Reck void onPageStarted(Tab tab, WebView view, Bitmap favicon); 548233facddcc51865d612a919d450db6954aa48e3Michael Kolb 55324d440ea7dc44da8beef8a6c2e6f7a33b20a41dJohn Reck void onPageFinished(Tab tab); 568233facddcc51865d612a919d450db6954aa48e3Michael Kolb 5730c714c853a4239e72ab1e238ce2a92472d06ab0John Reck void onProgressChanged(Tab tab); 588233facddcc51865d612a919d450db6954aa48e3Michael Kolb 598233facddcc51865d612a919d450db6954aa48e3Michael Kolb void onReceivedTitle(Tab tab, final String title); 608233facddcc51865d612a919d450db6954aa48e3Michael Kolb 618233facddcc51865d612a919d450db6954aa48e3Michael Kolb void onFavicon(Tab tab, WebView view, Bitmap icon); 628233facddcc51865d612a919d450db6954aa48e3Michael Kolb 6318eb377badf8e6f9ea2925bcb7e978facf3171d9Michael Kolb boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url); 648233facddcc51865d612a919d450db6954aa48e3Michael Kolb 658233facddcc51865d612a919d450db6954aa48e3Michael Kolb boolean shouldOverrideKeyEvent(KeyEvent event); 668233facddcc51865d612a919d450db6954aa48e3Michael Kolb 67997b1b7695822cb2dc2deca0458a5649d00b9953John Reck boolean onUnhandledKeyEvent(KeyEvent event); 688233facddcc51865d612a919d450db6954aa48e3Michael Kolb 69324d440ea7dc44da8beef8a6c2e6f7a33b20a41dJohn Reck void doUpdateVisitedHistory(Tab tab, boolean isReload); 708233facddcc51865d612a919d450db6954aa48e3Michael Kolb 718233facddcc51865d612a919d450db6954aa48e3Michael Kolb void getVisitedHistory(final ValueCallback<String[]> callback); 728233facddcc51865d612a919d450db6954aa48e3Michael Kolb 738233facddcc51865d612a919d450db6954aa48e3Michael Kolb void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler, 748233facddcc51865d612a919d450db6954aa48e3Michael Kolb final String host, final String realm); 758233facddcc51865d612a919d450db6954aa48e3Michael Kolb 768233facddcc51865d612a919d450db6954aa48e3Michael Kolb void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition, 770b3d66fc2275fb5270cb7166cc991be7dc9d8ff7Selim Gurun String mimeType, String referer, long contentLength); 788233facddcc51865d612a919d450db6954aa48e3Michael Kolb 791461244018a225006a8d4c203f9dfe294ffe94faMichael Kolb void showCustomView(Tab tab, View view, int requestedOrientation, 802d4f1e2553dee6bce5a12162ff6d4459babe2512Derek Sollenberger WebChromeClient.CustomViewCallback callback); 818233facddcc51865d612a919d450db6954aa48e3Michael Kolb 828233facddcc51865d612a919d450db6954aa48e3Michael Kolb void hideCustomView(); 838233facddcc51865d612a919d450db6954aa48e3Michael Kolb 848233facddcc51865d612a919d450db6954aa48e3Michael Kolb Bitmap getDefaultVideoPoster(); 858233facddcc51865d612a919d450db6954aa48e3Michael Kolb 868233facddcc51865d612a919d450db6954aa48e3Michael Kolb View getVideoLoadingProgressView(); 878233facddcc51865d612a919d450db6954aa48e3Michael Kolb 888233facddcc51865d612a919d450db6954aa48e3Michael Kolb void showSslCertificateOnError(WebView view, SslErrorHandler handler, 898233facddcc51865d612a919d450db6954aa48e3Michael Kolb SslError error); 908233facddcc51865d612a919d450db6954aa48e3Michael Kolb 9130c714c853a4239e72ab1e238ce2a92472d06ab0John Reck void onUserCanceledSsl(Tab tab); 9230c714c853a4239e72ab1e238ce2a92472d06ab0John Reck 938233facddcc51865d612a919d450db6954aa48e3Michael Kolb boolean shouldShowErrorConsole(); 948233facddcc51865d612a919d450db6954aa48e3Michael Kolb 952466effd6ef97aa17396c214d51f9f19a4760260Steve Block void onUpdatedSecurityState(Tab tab); 968233facddcc51865d612a919d450db6954aa48e3Michael Kolb 974d59434c396e3d414ed4266103d6990a340331e1Selim Gurun void showFileChooser(ValueCallback<Uri[]> callback, FileChooserParams params); 988233facddcc51865d612a919d450db6954aa48e3Michael Kolb 998233facddcc51865d612a919d450db6954aa48e3Michael Kolb void endActionMode(); 1008233facddcc51865d612a919d450db6954aa48e3Michael Kolb 1018233facddcc51865d612a919d450db6954aa48e3Michael Kolb void attachSubWindow(Tab tab); 1028233facddcc51865d612a919d450db6954aa48e3Michael Kolb 1038233facddcc51865d612a919d450db6954aa48e3Michael Kolb void dismissSubWindow(Tab tab); 1048233facddcc51865d612a919d450db6954aa48e3Michael Kolb 1057bcafde2ba532941c1eb8c9022eebd5398aeae2aMichael Kolb Tab openTab(String url, boolean incognito, boolean setActive, 1067bcafde2ba532941c1eb8c9022eebd5398aeae2aMichael Kolb boolean useCurrent); 1078233facddcc51865d612a919d450db6954aa48e3Michael Kolb 1085949c661b51295148706d53a03b41df2eb840ae3John Reck Tab openTab(String url, Tab parent, boolean setActive, 1095949c661b51295148706d53a03b41df2eb840ae3John Reck boolean useCurrent); 1105949c661b51295148706d53a03b41df2eb840ae3John Reck 111c831b63308dd1f8ef71808db8344ca2566ba4ed4Michael Kolb boolean switchToTab(Tab tab); 1128233facddcc51865d612a919d450db6954aa48e3Michael Kolb 1138233facddcc51865d612a919d450db6954aa48e3Michael Kolb void closeTab(Tab tab); 1148233facddcc51865d612a919d450db6954aa48e3Michael Kolb 1154cd97793901e8f5681cf642d0b2684697964a37aLeon Scroggins void bookmarkedStatusHasChanged(Tab tab); 1164cd97793901e8f5681cf642d0b2684697964a37aLeon Scroggins 1179206677e461328f15854c5fcb1366d0e261534c6Patrick Scott void showAutoLogin(Tab tab); 1189206677e461328f15854c5fcb1366d0e261534c6Patrick Scott 1199206677e461328f15854c5fcb1366d0e261534c6Patrick Scott void hideAutoLogin(Tab tab); 1201cf4b79a0020bc18c83ca8bde0e318ecd5252bc2John Reck 1211cf4b79a0020bc18c83ca8bde0e318ecd5252bc2John Reck boolean shouldCaptureThumbnails(); 1228233facddcc51865d612a919d450db6954aa48e3Michael Kolb} 123