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