blob: 87703bd1d3f11cddab8f9b313c12c7255f5f1a81 [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;
20import android.graphics.Bitmap;
21import android.net.Uri;
22import android.net.http.SslError;
Ben Murdoch8029a772010-11-16 11:58:21 +000023import android.os.Message;
Michael Kolb8233fac2010-10-26 16:08:53 -070024import android.view.KeyEvent;
25import android.view.View;
26import android.webkit.HttpAuthHandler;
27import android.webkit.SslErrorHandler;
28import android.webkit.ValueCallback;
29import android.webkit.WebChromeClient;
30import android.webkit.WebView;
31
Michael Kolb11d19782011-03-20 10:17:40 -070032import java.util.List;
33
Michael Kolb8233fac2010-10-26 16:08:53 -070034/**
35 * WebView aspect of the controller
36 */
37public interface WebViewController {
38
39 Activity getActivity();
40
41 TabControl getTabControl();
42
Michael Kolb1514bb72010-11-22 09:11:48 -080043 WebViewFactory getWebViewFactory();
44
Michael Kolba713ec82010-11-29 17:27:06 -080045 void onSetWebView(Tab tab, WebView view);
46
Michael Kolb1514bb72010-11-22 09:11:48 -080047 void createSubWindow(Tab tab);
48
John Reck324d4402011-01-11 16:56:42 -080049 void onPageStarted(Tab tab, WebView view, Bitmap favicon);
Michael Kolb8233fac2010-10-26 16:08:53 -070050
John Reck324d4402011-01-11 16:56:42 -080051 void onPageFinished(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070052
John Reck30c714c2010-12-16 17:30:34 -080053 void onProgressChanged(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070054
55 void onReceivedTitle(Tab tab, final String title);
56
57 void onFavicon(Tab tab, WebView view, Bitmap icon);
58
Michael Kolb18eb3772010-12-10 14:29:51 -080059 boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
Michael Kolb8233fac2010-10-26 16:08:53 -070060
61 boolean shouldOverrideKeyEvent(KeyEvent event);
62
63 void onUnhandledKeyEvent(KeyEvent event);
64
John Reck324d4402011-01-11 16:56:42 -080065 void doUpdateVisitedHistory(Tab tab, boolean isReload);
Michael Kolb8233fac2010-10-26 16:08:53 -070066
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 Reck30c714c2010-12-16 17:30:34 -080086 void onUserCanceledSsl(Tab tab);
87
Michael Kolb11d19782011-03-20 10:17:40 -070088 void activateVoiceSearchMode(String title, List<String> results);
Michael Kolb8233fac2010-10-26 16:08:53 -070089
90 void revertVoiceSearchMode(Tab tab);
91
92 boolean shouldShowErrorConsole();
93
John Reck30c714c2010-12-16 17:30:34 -080094 void onUpdatedLockIcon(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070095
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 Kolb7bcafde2011-05-09 13:55:59 -0700104 Tab openTab(String url, boolean incognito, boolean setActive,
105 boolean useCurrent);
Michael Kolb8233fac2010-10-26 16:08:53 -0700106
John Reck5949c662011-05-27 09:52:29 -0700107 Tab openTab(String url, Tab parent, boolean setActive,
108 boolean useCurrent);
109
Michael Kolbc831b632011-05-11 09:30:34 -0700110 boolean switchToTab(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -0700111
112 void closeTab(Tab tab);
113
Ben Murdoch8029a772010-11-16 11:58:21 +0000114 void setupAutoFill(Message message);
115
Leon Scroggins4cd97792010-12-03 15:31:56 -0500116 void bookmarkedStatusHasChanged(Tab tab);
117
Patrick Scott92066772011-03-10 08:46:27 -0500118 void showAutoLogin(Tab tab);
119
120 void hideAutoLogin(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -0700121}