Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 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 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 19 | import android.app.Activity; |
Michael Kolb | 1461244 | 2011-06-24 13:06:29 -0700 | [diff] [blame] | 20 | import android.content.Context; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 21 | import android.graphics.Bitmap; |
| 22 | import android.net.Uri; |
| 23 | import android.net.http.SslError; |
Ben Murdoch | 8029a77 | 2010-11-16 11:58:21 +0000 | [diff] [blame] | 24 | import android.os.Message; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 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.WebView; |
| 32 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 33 | import java.util.List; |
| 34 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 35 | /** |
| 36 | * WebView aspect of the controller |
| 37 | */ |
| 38 | public interface WebViewController { |
| 39 | |
Michael Kolb | 1461244 | 2011-06-24 13:06:29 -0700 | [diff] [blame] | 40 | Context getContext(); |
| 41 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 42 | Activity getActivity(); |
| 43 | |
| 44 | TabControl getTabControl(); |
| 45 | |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 46 | WebViewFactory getWebViewFactory(); |
| 47 | |
Michael Kolb | a713ec8 | 2010-11-29 17:27:06 -0800 | [diff] [blame] | 48 | void onSetWebView(Tab tab, WebView view); |
| 49 | |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 50 | void createSubWindow(Tab tab); |
| 51 | |
John Reck | 324d440 | 2011-01-11 16:56:42 -0800 | [diff] [blame] | 52 | void onPageStarted(Tab tab, WebView view, Bitmap favicon); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 53 | |
John Reck | 324d440 | 2011-01-11 16:56:42 -0800 | [diff] [blame] | 54 | void onPageFinished(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 55 | |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 56 | void onProgressChanged(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 57 | |
| 58 | void onReceivedTitle(Tab tab, final String title); |
| 59 | |
| 60 | void onFavicon(Tab tab, WebView view, Bitmap icon); |
| 61 | |
Michael Kolb | 18eb377 | 2010-12-10 14:29:51 -0800 | [diff] [blame] | 62 | boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 63 | |
| 64 | boolean shouldOverrideKeyEvent(KeyEvent event); |
| 65 | |
| 66 | void onUnhandledKeyEvent(KeyEvent event); |
| 67 | |
John Reck | 324d440 | 2011-01-11 16:56:42 -0800 | [diff] [blame] | 68 | void doUpdateVisitedHistory(Tab tab, boolean isReload); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 69 | |
| 70 | void getVisitedHistory(final ValueCallback<String[]> callback); |
| 71 | |
| 72 | void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler, |
| 73 | final String host, final String realm); |
| 74 | |
| 75 | void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition, |
| 76 | String mimeType, long contentLength); |
| 77 | |
Michael Kolb | 1461244 | 2011-06-24 13:06:29 -0700 | [diff] [blame] | 78 | void showCustomView(Tab tab, View view, int requestedOrientation, |
Derek Sollenberger | 2d4f1e2 | 2011-06-01 14:50:42 -0400 | [diff] [blame] | 79 | WebChromeClient.CustomViewCallback callback); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 80 | |
| 81 | void hideCustomView(); |
| 82 | |
| 83 | Bitmap getDefaultVideoPoster(); |
| 84 | |
| 85 | View getVideoLoadingProgressView(); |
| 86 | |
| 87 | void showSslCertificateOnError(WebView view, SslErrorHandler handler, |
| 88 | SslError error); |
| 89 | |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 90 | void onUserCanceledSsl(Tab tab); |
| 91 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 92 | void activateVoiceSearchMode(String title, List<String> results); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 93 | |
| 94 | void revertVoiceSearchMode(Tab tab); |
| 95 | |
| 96 | boolean shouldShowErrorConsole(); |
| 97 | |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 98 | void onUpdatedLockIcon(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 99 | |
| 100 | void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType); |
| 101 | |
| 102 | void endActionMode(); |
| 103 | |
| 104 | void attachSubWindow(Tab tab); |
| 105 | |
| 106 | void dismissSubWindow(Tab tab); |
| 107 | |
Michael Kolb | 7bcafde | 2011-05-09 13:55:59 -0700 | [diff] [blame] | 108 | Tab openTab(String url, boolean incognito, boolean setActive, |
| 109 | boolean useCurrent); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 110 | |
John Reck | 5949c66 | 2011-05-27 09:52:29 -0700 | [diff] [blame] | 111 | Tab openTab(String url, Tab parent, boolean setActive, |
| 112 | boolean useCurrent); |
| 113 | |
Michael Kolb | c831b63 | 2011-05-11 09:30:34 -0700 | [diff] [blame] | 114 | boolean switchToTab(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 115 | |
| 116 | void closeTab(Tab tab); |
| 117 | |
Ben Murdoch | 8029a77 | 2010-11-16 11:58:21 +0000 | [diff] [blame] | 118 | void setupAutoFill(Message message); |
| 119 | |
Leon Scroggins | 4cd9779 | 2010-12-03 15:31:56 -0500 | [diff] [blame] | 120 | void bookmarkedStatusHasChanged(Tab tab); |
| 121 | |
Patrick Scott | 9206677 | 2011-03-10 08:46:27 -0500 | [diff] [blame] | 122 | void showAutoLogin(Tab tab); |
| 123 | |
| 124 | void hideAutoLogin(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 125 | } |