WebViewController.java revision 7bcafde2ba532941c1eb8c9022eebd5398aeae2a
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
17package com.android.browser;
18
19import android.app.Activity;
20import android.graphics.Bitmap;
21import android.net.Uri;
22import android.net.http.SslError;
23import android.os.Message;
24import 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
32import java.util.List;
33
34/**
35 * WebView aspect of the controller
36 */
37public interface WebViewController {
38
39    Activity getActivity();
40
41    TabControl getTabControl();
42
43    WebViewFactory getWebViewFactory();
44
45    void onSetWebView(Tab tab, WebView view);
46
47    void createSubWindow(Tab tab);
48
49    void onPageStarted(Tab tab, WebView view, Bitmap favicon);
50
51    void onPageFinished(Tab tab);
52
53    void onProgressChanged(Tab tab);
54
55    void onReceivedTitle(Tab tab, final String title);
56
57    void onFavicon(Tab tab, WebView view, Bitmap icon);
58
59    boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
60
61    boolean shouldOverrideKeyEvent(KeyEvent event);
62
63    void onUnhandledKeyEvent(KeyEvent event);
64
65    void doUpdateVisitedHistory(Tab tab, boolean isReload);
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
86    void onUserCanceledSsl(Tab tab);
87
88    void activateVoiceSearchMode(String title, List<String> results);
89
90    void revertVoiceSearchMode(Tab tab);
91
92    boolean shouldShowErrorConsole();
93
94    void onUpdatedLockIcon(Tab tab);
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
104    Tab openTab(String url, boolean incognito, boolean setActive,
105            boolean useCurrent);
106
107    boolean switchToTab(int tabindex);
108
109    void closeTab(Tab tab);
110
111    void setupAutoFill(Message message);
112
113    void bookmarkedStatusHasChanged(Tab tab);
114
115    void showAutoLogin(Tab tab);
116
117    void hideAutoLogin(Tab tab);
118}
119