blob: 30eec4f1297976c470c4cec6b87b40c000801185 [file] [log] [blame]
Michael Kolb8233fac2010-10-26 16:08:53 -07001/*
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
17package com.android.browser;
18
Michael Kolb8233fac2010-10-26 16:08:53 -070019import android.app.Activity;
Michael Kolb14612442011-06-24 13:06:29 -070020import android.content.Context;
Michael Kolb8233fac2010-10-26 16:08:53 -070021import android.graphics.Bitmap;
22import android.net.Uri;
23import android.net.http.SslError;
Ben Murdoch8029a772010-11-16 11:58:21 +000024import android.os.Message;
Michael Kolb8233fac2010-10-26 16:08:53 -070025import android.view.KeyEvent;
26import android.view.View;
27import android.webkit.HttpAuthHandler;
28import android.webkit.SslErrorHandler;
29import android.webkit.ValueCallback;
30import android.webkit.WebChromeClient;
31import android.webkit.WebView;
32
Michael Kolb11d19782011-03-20 10:17:40 -070033import java.util.List;
34
Michael Kolb8233fac2010-10-26 16:08:53 -070035/**
36 * WebView aspect of the controller
37 */
38public interface WebViewController {
39
Michael Kolb14612442011-06-24 13:06:29 -070040 Context getContext();
41
Michael Kolb8233fac2010-10-26 16:08:53 -070042 Activity getActivity();
43
44 TabControl getTabControl();
45
Michael Kolb1514bb72010-11-22 09:11:48 -080046 WebViewFactory getWebViewFactory();
47
Michael Kolba713ec82010-11-29 17:27:06 -080048 void onSetWebView(Tab tab, WebView view);
49
Michael Kolb1514bb72010-11-22 09:11:48 -080050 void createSubWindow(Tab tab);
51
John Reck324d4402011-01-11 16:56:42 -080052 void onPageStarted(Tab tab, WebView view, Bitmap favicon);
Michael Kolb8233fac2010-10-26 16:08:53 -070053
John Reck324d4402011-01-11 16:56:42 -080054 void onPageFinished(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070055
John Reck30c714c2010-12-16 17:30:34 -080056 void onProgressChanged(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070057
58 void onReceivedTitle(Tab tab, final String title);
59
60 void onFavicon(Tab tab, WebView view, Bitmap icon);
61
Michael Kolb18eb3772010-12-10 14:29:51 -080062 boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
Michael Kolb8233fac2010-10-26 16:08:53 -070063
64 boolean shouldOverrideKeyEvent(KeyEvent event);
65
66 void onUnhandledKeyEvent(KeyEvent event);
67
John Reck324d4402011-01-11 16:56:42 -080068 void doUpdateVisitedHistory(Tab tab, boolean isReload);
Michael Kolb8233fac2010-10-26 16:08:53 -070069
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 Kolb14612442011-06-24 13:06:29 -070078 void showCustomView(Tab tab, View view, int requestedOrientation,
Derek Sollenberger2d4f1e22011-06-01 14:50:42 -040079 WebChromeClient.CustomViewCallback callback);
Michael Kolb8233fac2010-10-26 16:08:53 -070080
81 void hideCustomView();
82
83 Bitmap getDefaultVideoPoster();
84
85 View getVideoLoadingProgressView();
86
87 void showSslCertificateOnError(WebView view, SslErrorHandler handler,
88 SslError error);
89
John Reck30c714c2010-12-16 17:30:34 -080090 void onUserCanceledSsl(Tab tab);
91
Michael Kolb11d19782011-03-20 10:17:40 -070092 void activateVoiceSearchMode(String title, List<String> results);
Michael Kolb8233fac2010-10-26 16:08:53 -070093
94 void revertVoiceSearchMode(Tab tab);
95
96 boolean shouldShowErrorConsole();
97
Steve Block2466eff2011-10-03 15:33:09 +010098 void onUpdatedSecurityState(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070099
Ben Murdoch8cad4132012-01-11 10:56:43 +0000100 void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture);
Michael Kolb8233fac2010-10-26 16:08:53 -0700101
102 void endActionMode();
103
104 void attachSubWindow(Tab tab);
105
106 void dismissSubWindow(Tab tab);
107
Michael Kolb7bcafde2011-05-09 13:55:59 -0700108 Tab openTab(String url, boolean incognito, boolean setActive,
109 boolean useCurrent);
Michael Kolb8233fac2010-10-26 16:08:53 -0700110
John Reck5949c662011-05-27 09:52:29 -0700111 Tab openTab(String url, Tab parent, boolean setActive,
112 boolean useCurrent);
113
Michael Kolbc831b632011-05-11 09:30:34 -0700114 boolean switchToTab(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -0700115
116 void closeTab(Tab tab);
117
Ben Murdoch8029a772010-11-16 11:58:21 +0000118 void setupAutoFill(Message message);
119
Leon Scroggins4cd97792010-12-03 15:31:56 -0500120 void bookmarkedStatusHasChanged(Tab tab);
121
Patrick Scott92066772011-03-10 08:46:27 -0500122 void showAutoLogin(Tab tab);
123
124 void hideAutoLogin(Tab tab);
John Reck1cf4b792011-07-26 10:22:22 -0700125
126 boolean shouldCaptureThumbnails();
Michael Kolb8233fac2010-10-26 16:08:53 -0700127}