blob: 93ca41080937e5baa532169b02240f34246cbb54 [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
19import com.android.browser.IntentHandler.UrlData;
20
21import android.app.Activity;
22import android.graphics.Bitmap;
23import android.net.Uri;
24import android.net.http.SslError;
Ben Murdoch8029a772010-11-16 11:58:21 +000025import android.os.Message;
Michael Kolb8233fac2010-10-26 16:08:53 -070026import android.view.KeyEvent;
27import android.view.View;
28import android.webkit.HttpAuthHandler;
29import android.webkit.SslErrorHandler;
30import android.webkit.ValueCallback;
31import android.webkit.WebChromeClient;
32import android.webkit.WebView;
33
Michael Kolb11d19782011-03-20 10:17:40 -070034import java.util.List;
35
Michael Kolb8233fac2010-10-26 16:08:53 -070036/**
37 * WebView aspect of the controller
38 */
39public interface WebViewController {
40
41 Activity getActivity();
42
43 TabControl getTabControl();
44
Michael Kolb1514bb72010-11-22 09:11:48 -080045 WebViewFactory getWebViewFactory();
46
Michael Kolba713ec82010-11-29 17:27:06 -080047 void onSetWebView(Tab tab, WebView view);
48
Michael Kolb1514bb72010-11-22 09:11:48 -080049 void createSubWindow(Tab tab);
50
John Reck324d4402011-01-11 16:56:42 -080051 void onPageStarted(Tab tab, WebView view, Bitmap favicon);
Michael Kolb8233fac2010-10-26 16:08:53 -070052
John Reck324d4402011-01-11 16:56:42 -080053 void onPageFinished(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070054
John Reck30c714c2010-12-16 17:30:34 -080055 void onProgressChanged(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070056
57 void onReceivedTitle(Tab tab, final String title);
58
59 void onFavicon(Tab tab, WebView view, Bitmap icon);
60
Michael Kolb18eb3772010-12-10 14:29:51 -080061 boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
Michael Kolb8233fac2010-10-26 16:08:53 -070062
63 boolean shouldOverrideKeyEvent(KeyEvent event);
64
65 void onUnhandledKeyEvent(KeyEvent event);
66
John Reck324d4402011-01-11 16:56:42 -080067 void doUpdateVisitedHistory(Tab tab, boolean isReload);
Michael Kolb8233fac2010-10-26 16:08:53 -070068
69 void getVisitedHistory(final ValueCallback<String[]> callback);
70
71 void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler,
72 final String host, final String realm);
73
74 void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition,
75 String mimeType, long contentLength);
76
77 void showCustomView(Tab tab, View view, WebChromeClient.CustomViewCallback callback);
78
79 void hideCustomView();
80
81 Bitmap getDefaultVideoPoster();
82
83 View getVideoLoadingProgressView();
84
85 void showSslCertificateOnError(WebView view, SslErrorHandler handler,
86 SslError error);
87
John Reck30c714c2010-12-16 17:30:34 -080088 void onUserCanceledSsl(Tab tab);
89
Michael Kolb11d19782011-03-20 10:17:40 -070090 void activateVoiceSearchMode(String title, List<String> results);
Michael Kolb8233fac2010-10-26 16:08:53 -070091
92 void revertVoiceSearchMode(Tab tab);
93
94 boolean shouldShowErrorConsole();
95
John Reck30c714c2010-12-16 17:30:34 -080096 void onUpdatedLockIcon(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070097
98 void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType);
99
100 void endActionMode();
101
102 void attachSubWindow(Tab tab);
103
104 void dismissSubWindow(Tab tab);
105
Michael Kolb18eb3772010-12-10 14:29:51 -0800106 Tab openTabAndShow(Tab parent, UrlData urlData, boolean closeOnExit,
107 String appId);
Michael Kolb8233fac2010-10-26 16:08:53 -0700108
109 boolean switchToTab(int tabindex);
110
111 void closeTab(Tab tab);
112
Ben Murdoch8029a772010-11-16 11:58:21 +0000113 void setupAutoFill(Message message);
114
Leon Scroggins4cd97792010-12-03 15:31:56 -0500115 void bookmarkedStatusHasChanged(Tab tab);
116
Patrick Scott92066772011-03-10 08:46:27 -0500117 void showAutoLogin(Tab tab);
118
119 void hideAutoLogin(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -0700120}