blob: 8c99c58df152de7876a58a8376e5e1a679712782 [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;
25import 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
33/**
34 * WebView aspect of the controller
35 */
36public interface WebViewController {
37
38 Activity getActivity();
39
40 TabControl getTabControl();
41
Michael Kolb1514bb72010-11-22 09:11:48 -080042 WebViewFactory getWebViewFactory();
43
44 void createSubWindow(Tab tab);
45
Michael Kolb8233fac2010-10-26 16:08:53 -070046 void onPageStarted(Tab tab, WebView view, String url, Bitmap favicon);
47
48 void onPageFinished(Tab tab, String url);
49
50 void onProgressChanged(Tab tab, int newProgress);
51
52 void onReceivedTitle(Tab tab, final String title);
53
54 void onFavicon(Tab tab, WebView view, Bitmap icon);
55
56 boolean shouldOverrideUrlLoading(WebView view, String url);
57
58 boolean shouldOverrideKeyEvent(KeyEvent event);
59
60 void onUnhandledKeyEvent(KeyEvent event);
61
62 void doUpdateVisitedHistory(Tab tab, String url, boolean isReload);
63
64 void getVisitedHistory(final ValueCallback<String[]> callback);
65
66 void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler,
67 final String host, final String realm);
68
69 void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition,
70 String mimeType, long contentLength);
71
72 void showCustomView(Tab tab, View view, WebChromeClient.CustomViewCallback callback);
73
74 void hideCustomView();
75
76 Bitmap getDefaultVideoPoster();
77
78 View getVideoLoadingProgressView();
79
80 void showSslCertificateOnError(WebView view, SslErrorHandler handler,
81 SslError error);
82
83 void activateVoiceSearchMode(String title);
84
85 void revertVoiceSearchMode(Tab tab);
86
87 boolean shouldShowErrorConsole();
88
89 void resetTitleAndRevertLockIcon(Tab tab);
90
91 void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType);
92
93 void endActionMode();
94
95 void attachSubWindow(Tab tab);
96
97 void dismissSubWindow(Tab tab);
98
99 Tab openTabAndShow(UrlData urlData, boolean closeOnExit, String appId);
100
101 boolean switchToTab(int tabindex);
102
103 void closeTab(Tab tab);
104
105}