1 /* 2 * Copyright (C) 2010 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 com.android.browser; 18 19 import android.app.Activity; 20 import android.content.Context; 21 import android.graphics.Bitmap; 22 import android.net.Uri; 23 import android.net.http.SslError; 24 import android.os.Message; 25 import android.view.KeyEvent; 26 import android.view.View; 27 import android.webkit.HttpAuthHandler; 28 import android.webkit.SslErrorHandler; 29 import android.webkit.ValueCallback; 30 import android.webkit.WebChromeClient; 31 import android.webkit.WebChromeClient.FileChooserParams; 32 import android.webkit.WebView; 33 34 import java.util.List; 35 36 /** 37 * WebView aspect of the controller 38 */ 39 public interface WebViewController { 40 getContext()41 Context getContext(); 42 getActivity()43 Activity getActivity(); 44 getTabControl()45 TabControl getTabControl(); 46 getWebViewFactory()47 WebViewFactory getWebViewFactory(); 48 onSetWebView(Tab tab, WebView view)49 void onSetWebView(Tab tab, WebView view); 50 createSubWindow(Tab tab)51 void createSubWindow(Tab tab); 52 onPageStarted(Tab tab, WebView view, Bitmap favicon)53 void onPageStarted(Tab tab, WebView view, Bitmap favicon); 54 onPageFinished(Tab tab)55 void onPageFinished(Tab tab); 56 onProgressChanged(Tab tab)57 void onProgressChanged(Tab tab); 58 onReceivedTitle(Tab tab, final String title)59 void onReceivedTitle(Tab tab, final String title); 60 onFavicon(Tab tab, WebView view, Bitmap icon)61 void onFavicon(Tab tab, WebView view, Bitmap icon); 62 shouldOverrideUrlLoading(Tab tab, WebView view, String url)63 boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url); 64 shouldOverrideKeyEvent(KeyEvent event)65 boolean shouldOverrideKeyEvent(KeyEvent event); 66 onUnhandledKeyEvent(KeyEvent event)67 boolean onUnhandledKeyEvent(KeyEvent event); 68 doUpdateVisitedHistory(Tab tab, boolean isReload)69 void doUpdateVisitedHistory(Tab tab, boolean isReload); 70 getVisitedHistory(final ValueCallback<String[]> callback)71 void getVisitedHistory(final ValueCallback<String[]> callback); 72 onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler, final String host, final String realm)73 void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler, 74 final String host, final String realm); 75 onDownloadStart(Tab tab, String url, String useragent, String contentDisposition, String mimeType, String referer, long contentLength)76 void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition, 77 String mimeType, String referer, long contentLength); 78 showCustomView(Tab tab, View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback)79 void showCustomView(Tab tab, View view, int requestedOrientation, 80 WebChromeClient.CustomViewCallback callback); 81 hideCustomView()82 void hideCustomView(); 83 getDefaultVideoPoster()84 Bitmap getDefaultVideoPoster(); 85 getVideoLoadingProgressView()86 View getVideoLoadingProgressView(); 87 showSslCertificateOnError(WebView view, SslErrorHandler handler, SslError error)88 void showSslCertificateOnError(WebView view, SslErrorHandler handler, 89 SslError error); 90 onUserCanceledSsl(Tab tab)91 void onUserCanceledSsl(Tab tab); 92 shouldShowErrorConsole()93 boolean shouldShowErrorConsole(); 94 onUpdatedSecurityState(Tab tab)95 void onUpdatedSecurityState(Tab tab); 96 showFileChooser(ValueCallback<Uri[]> callback, FileChooserParams params)97 void showFileChooser(ValueCallback<Uri[]> callback, FileChooserParams params); 98 endActionMode()99 void endActionMode(); 100 attachSubWindow(Tab tab)101 void attachSubWindow(Tab tab); 102 dismissSubWindow(Tab tab)103 void dismissSubWindow(Tab tab); 104 openTab(String url, boolean incognito, boolean setActive, boolean useCurrent)105 Tab openTab(String url, boolean incognito, boolean setActive, 106 boolean useCurrent); 107 openTab(String url, Tab parent, boolean setActive, boolean useCurrent)108 Tab openTab(String url, Tab parent, boolean setActive, 109 boolean useCurrent); 110 switchToTab(Tab tab)111 boolean switchToTab(Tab tab); 112 closeTab(Tab tab)113 void closeTab(Tab tab); 114 bookmarkedStatusHasChanged(Tab tab)115 void bookmarkedStatusHasChanged(Tab tab); 116 showAutoLogin(Tab tab)117 void showAutoLogin(Tab tab); 118 hideAutoLogin(Tab tab)119 void hideAutoLogin(Tab tab); 120 shouldCaptureThumbnails()121 boolean shouldCaptureThumbnails(); 122 } 123