blob: 6bf2f69b5e612b412eb01b8cc0ea28ffbd51a53e [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
Bijan Amirzada41242f22014-03-21 12:12:18 -070017package com.android.browser;
Michael Kolb8233fac2010-10-26 16:08:53 -070018
Michael Kolb8233fac2010-10-26 16:08:53 -070019import android.app.Activity;
Michael Kolb14612442011-06-24 13:06:29 -070020import android.content.Context;
Michael Kolb8233fac2010-10-26 16:08:53 -070021import android.graphics.Bitmap;
22import android.net.Uri;
Ben Murdoch8029a772010-11-16 11:58:21 +000023import android.os.Message;
Michael Kolb8233fac2010-10-26 16:08:53 -070024import android.view.KeyEvent;
25import android.view.View;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080026import org.codeaurora.swe.HttpAuthHandler;
Michael Kolb8233fac2010-10-26 16:08:53 -070027import android.webkit.ValueCallback;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080028import android.webkit.WebChromeClient.CustomViewCallback;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080029import org.codeaurora.swe.WebView;
Michael Kolb8233fac2010-10-26 16:08:53 -070030
Michael Kolb11d19782011-03-20 10:17:40 -070031import java.util.List;
32
Michael Kolb8233fac2010-10-26 16:08:53 -070033/**
34 * WebView aspect of the controller
35 */
36public interface WebViewController {
37
Michael Kolb14612442011-06-24 13:06:29 -070038 Context getContext();
39
Michael Kolb8233fac2010-10-26 16:08:53 -070040 Activity getActivity();
41
42 TabControl getTabControl();
43
Michael Kolb1514bb72010-11-22 09:11:48 -080044 WebViewFactory getWebViewFactory();
45
Michael Kolba713ec82010-11-29 17:27:06 -080046 void onSetWebView(Tab tab, WebView view);
47
Michael Kolb1514bb72010-11-22 09:11:48 -080048 void createSubWindow(Tab tab);
49
John Reck324d4402011-01-11 16:56:42 -080050 void onPageStarted(Tab tab, WebView view, Bitmap favicon);
Michael Kolb8233fac2010-10-26 16:08:53 -070051
John Reck324d4402011-01-11 16:56:42 -080052 void onPageFinished(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070053
John Reck30c714c2010-12-16 17:30:34 -080054 void onProgressChanged(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070055
56 void onReceivedTitle(Tab tab, final String title);
57
58 void onFavicon(Tab tab, WebView view, Bitmap icon);
59
Michael Kolb18eb3772010-12-10 14:29:51 -080060 boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
Michael Kolb8233fac2010-10-26 16:08:53 -070061
62 boolean shouldOverrideKeyEvent(KeyEvent event);
63
John Reck997b1b72012-04-19 18:08:25 -070064 boolean onUnhandledKeyEvent(KeyEvent event);
Michael Kolb8233fac2010-10-26 16:08:53 -070065
John Reck324d4402011-01-11 16:56:42 -080066 void doUpdateVisitedHistory(Tab tab, boolean isReload);
Michael Kolb8233fac2010-10-26 16:08:53 -070067
68 void getVisitedHistory(final ValueCallback<String[]> callback);
69
70 void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler,
71 final String host, final String realm);
72
73 void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition,
Selim Gurun0b3d66f2012-08-29 13:08:13 -070074 String mimeType, String referer, long contentLength);
Michael Kolb8233fac2010-10-26 16:08:53 -070075
Michael Kolb14612442011-06-24 13:06:29 -070076 void showCustomView(Tab tab, View view, int requestedOrientation,
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080077 CustomViewCallback callback);
Michael Kolb8233fac2010-10-26 16:08:53 -070078
79 void hideCustomView();
80
81 Bitmap getDefaultVideoPoster();
82
83 View getVideoLoadingProgressView();
84
John Reck30c714c2010-12-16 17:30:34 -080085 void onUserCanceledSsl(Tab tab);
86
Steve Block2466eff2011-10-03 15:33:09 +010087 void onUpdatedSecurityState(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070088
Ben Murdoch8cad4132012-01-11 10:56:43 +000089 void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture);
Michael Kolb8233fac2010-10-26 16:08:53 -070090
Vivek Sekharb54614f2014-05-01 19:03:37 -070091 void showFileChooser(ValueCallback<String[]> uploadFilePaths, String acceptTypes,
92 boolean capture);
93
Michael Kolb8233fac2010-10-26 16:08:53 -070094 void endActionMode();
95
96 void attachSubWindow(Tab tab);
97
98 void dismissSubWindow(Tab tab);
99
Michael Kolb7bcafde2011-05-09 13:55:59 -0700100 Tab openTab(String url, boolean incognito, boolean setActive,
101 boolean useCurrent);
Michael Kolb8233fac2010-10-26 16:08:53 -0700102
John Reck5949c662011-05-27 09:52:29 -0700103 Tab openTab(String url, Tab parent, boolean setActive,
104 boolean useCurrent);
105
Michael Kolbc831b632011-05-11 09:30:34 -0700106 boolean switchToTab(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -0700107
108 void closeTab(Tab tab);
109
Ben Murdoch8029a772010-11-16 11:58:21 +0000110 void setupAutoFill(Message message);
111
Leon Scroggins4cd97792010-12-03 15:31:56 -0500112 void bookmarkedStatusHasChanged(Tab tab);
113
John Reck1cf4b792011-07-26 10:22:22 -0700114 boolean shouldCaptureThumbnails();
Pankaj Gargf49e0222015-09-01 12:19:13 -0700115
116 void onThumbnailCapture(Bitmap bm);
Michael Kolb8233fac2010-10-26 16:08:53 -0700117}