blob: fdd8ab10d9f19cb8199d694ed101b6ca25135b06 [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
42 void onPageStarted(Tab tab, WebView view, String url, Bitmap favicon);
43
44 void onPageFinished(Tab tab, String url);
45
46 void onProgressChanged(Tab tab, int newProgress);
47
48 void onReceivedTitle(Tab tab, final String title);
49
50 void onFavicon(Tab tab, WebView view, Bitmap icon);
51
52 boolean shouldOverrideUrlLoading(WebView view, String url);
53
54 boolean shouldOverrideKeyEvent(KeyEvent event);
55
56 void onUnhandledKeyEvent(KeyEvent event);
57
58 void doUpdateVisitedHistory(Tab tab, String url, boolean isReload);
59
60 void getVisitedHistory(final ValueCallback<String[]> callback);
61
62 void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler,
63 final String host, final String realm);
64
65 void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition,
66 String mimeType, long contentLength);
67
68 void showCustomView(Tab tab, View view, WebChromeClient.CustomViewCallback callback);
69
70 void hideCustomView();
71
72 Bitmap getDefaultVideoPoster();
73
74 View getVideoLoadingProgressView();
75
76 void showSslCertificateOnError(WebView view, SslErrorHandler handler,
77 SslError error);
78
79 void activateVoiceSearchMode(String title);
80
81 void revertVoiceSearchMode(Tab tab);
82
83 boolean shouldShowErrorConsole();
84
85 void resetTitleAndRevertLockIcon(Tab tab);
86
87 void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType);
88
89 void endActionMode();
90
91 void attachSubWindow(Tab tab);
92
93 void dismissSubWindow(Tab tab);
94
95 Tab openTabAndShow(UrlData urlData, boolean closeOnExit, String appId);
96
97 boolean switchToTab(int tabindex);
98
99 void closeTab(Tab tab);
100
101}