WebViewController.java revision 4cd97793901e8f5681cf642d0b2684697964a37a
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 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.os.Message;
26import 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
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, String url, Bitmap favicon);
50
51    void onPageFinished(Tab tab, String url);
52
53    void onProgressChanged(Tab tab, int newProgress);
54
55    void onReceivedTitle(Tab tab, final String title);
56
57    void onFavicon(Tab tab, WebView view, Bitmap icon);
58
59    boolean shouldOverrideUrlLoading(WebView view, String url);
60
61    boolean shouldOverrideKeyEvent(KeyEvent event);
62
63    void onUnhandledKeyEvent(KeyEvent event);
64
65    void doUpdateVisitedHistory(Tab tab, String url, 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 activateVoiceSearchMode(String title);
87
88    void revertVoiceSearchMode(Tab tab);
89
90    boolean shouldShowErrorConsole();
91
92    void resetTitleAndRevertLockIcon(Tab tab);
93
94    void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType);
95
96    void endActionMode();
97
98    void attachSubWindow(Tab tab);
99
100    void dismissSubWindow(Tab tab);
101
102    Tab openTabAndShow(UrlData urlData, boolean closeOnExit, String appId);
103
104    boolean switchToTab(int tabindex);
105
106    void closeTab(Tab tab);
107
108    void setupAutoFill(Message message);
109
110    void bookmarkedStatusHasChanged(Tab tab);
111
112}
113