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