blob: a187af0b37fe0948442d7e7fcbf0ddc9431d7549 [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
Michael Kolba713ec82010-11-29 17:27:06 -080045 void onSetWebView(Tab tab, WebView view);
46
Michael Kolb1514bb72010-11-22 09:11:48 -080047 void createSubWindow(Tab tab);
48
Michael Kolb8233fac2010-10-26 16:08:53 -070049 void onPageStarted(Tab tab, WebView view, String url, Bitmap favicon);
50
51 void onPageFinished(Tab tab, String url);
52
John Reck30c714c2010-12-16 17:30:34 -080053 void onProgressChanged(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070054
55 void onReceivedTitle(Tab tab, final String title);
56
57 void onFavicon(Tab tab, WebView view, Bitmap icon);
58
Michael Kolb18eb3772010-12-10 14:29:51 -080059 boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
Michael Kolb8233fac2010-10-26 16:08:53 -070060
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
John Reck30c714c2010-12-16 17:30:34 -080086 void onUserCanceledSsl(Tab tab);
87
Michael Kolb8233fac2010-10-26 16:08:53 -070088 void activateVoiceSearchMode(String title);
89
90 void revertVoiceSearchMode(Tab tab);
91
92 boolean shouldShowErrorConsole();
93
John Reck30c714c2010-12-16 17:30:34 -080094 void onUpdatedLockIcon(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070095
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
Michael Kolb18eb3772010-12-10 14:29:51 -0800104 Tab openTabAndShow(Tab parent, UrlData urlData, boolean closeOnExit,
105 String appId);
Michael Kolb8233fac2010-10-26 16:08:53 -0700106
107 boolean switchToTab(int tabindex);
108
109 void closeTab(Tab tab);
110
Ben Murdoch8029a772010-11-16 11:58:21 +0000111 void setupAutoFill(Message message);
112
Leon Scroggins4cd97792010-12-03 15:31:56 -0500113 void bookmarkedStatusHasChanged(Tab tab);
114
Michael Kolb8233fac2010-10-26 16:08:53 -0700115}