blob: 373d72c68c8de674233f0d7a77b13c0ab1164210 [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;
23import android.net.http.SslError;
Ben Murdoch8029a772010-11-16 11:58:21 +000024import android.os.Message;
Michael Kolb8233fac2010-10-26 16:08:53 -070025import android.view.KeyEvent;
26import android.view.View;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080027import org.codeaurora.swe.HttpAuthHandler;
28import org.codeaurora.swe.SslErrorHandler;
Michael Kolb8233fac2010-10-26 16:08:53 -070029import android.webkit.ValueCallback;
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080030import android.webkit.WebChromeClient.CustomViewCallback;
31import org.codeaurora.swe.WebChromeClient;
32import org.codeaurora.swe.WebView;
Michael Kolb8233fac2010-10-26 16:08:53 -070033
Michael Kolb11d19782011-03-20 10:17:40 -070034import java.util.List;
35
Michael Kolb8233fac2010-10-26 16:08:53 -070036/**
37 * WebView aspect of the controller
38 */
39public interface WebViewController {
40
Michael Kolb14612442011-06-24 13:06:29 -070041 Context getContext();
42
Michael Kolb8233fac2010-10-26 16:08:53 -070043 Activity getActivity();
44
45 TabControl getTabControl();
46
Michael Kolb1514bb72010-11-22 09:11:48 -080047 WebViewFactory getWebViewFactory();
48
Michael Kolba713ec82010-11-29 17:27:06 -080049 void onSetWebView(Tab tab, WebView view);
50
Michael Kolb1514bb72010-11-22 09:11:48 -080051 void createSubWindow(Tab tab);
52
John Reck324d4402011-01-11 16:56:42 -080053 void onPageStarted(Tab tab, WebView view, Bitmap favicon);
Michael Kolb8233fac2010-10-26 16:08:53 -070054
John Reck324d4402011-01-11 16:56:42 -080055 void onPageFinished(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070056
John Reck30c714c2010-12-16 17:30:34 -080057 void onProgressChanged(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070058
59 void onReceivedTitle(Tab tab, final String title);
60
61 void onFavicon(Tab tab, WebView view, Bitmap icon);
62
Michael Kolb18eb3772010-12-10 14:29:51 -080063 boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url);
Michael Kolb8233fac2010-10-26 16:08:53 -070064
65 boolean shouldOverrideKeyEvent(KeyEvent event);
66
John Reck997b1b72012-04-19 18:08:25 -070067 boolean onUnhandledKeyEvent(KeyEvent event);
Michael Kolb8233fac2010-10-26 16:08:53 -070068
John Reck324d4402011-01-11 16:56:42 -080069 void doUpdateVisitedHistory(Tab tab, boolean isReload);
Michael Kolb8233fac2010-10-26 16:08:53 -070070
71 void getVisitedHistory(final ValueCallback<String[]> callback);
72
73 void onReceivedHttpAuthRequest(Tab tab, WebView view, final HttpAuthHandler handler,
74 final String host, final String realm);
75
76 void onDownloadStart(Tab tab, String url, String useragent, String contentDisposition,
Selim Gurun0b3d66f2012-08-29 13:08:13 -070077 String mimeType, String referer, long contentLength);
Michael Kolb8233fac2010-10-26 16:08:53 -070078
Michael Kolb14612442011-06-24 13:06:29 -070079 void showCustomView(Tab tab, View view, int requestedOrientation,
Bijan Amirzada9b1e9882014-02-26 17:15:46 -080080 CustomViewCallback callback);
Michael Kolb8233fac2010-10-26 16:08:53 -070081
82 void hideCustomView();
83
84 Bitmap getDefaultVideoPoster();
85
86 View getVideoLoadingProgressView();
87
88 void showSslCertificateOnError(WebView view, SslErrorHandler handler,
89 SslError error);
90
John Reck30c714c2010-12-16 17:30:34 -080091 void onUserCanceledSsl(Tab tab);
92
Michael Kolb8233fac2010-10-26 16:08:53 -070093 boolean shouldShowErrorConsole();
94
Steve Block2466eff2011-10-03 15:33:09 +010095 void onUpdatedSecurityState(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -070096
Ben Murdoch8cad4132012-01-11 10:56:43 +000097 void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture);
Michael Kolb8233fac2010-10-26 16:08:53 -070098
Vivek Sekharb54614f2014-05-01 19:03:37 -070099 void showFileChooser(ValueCallback<String[]> uploadFilePaths, String acceptTypes,
100 boolean capture);
101
Michael Kolb8233fac2010-10-26 16:08:53 -0700102 void endActionMode();
103
104 void attachSubWindow(Tab tab);
105
106 void dismissSubWindow(Tab tab);
107
Michael Kolb7bcafde2011-05-09 13:55:59 -0700108 Tab openTab(String url, boolean incognito, boolean setActive,
109 boolean useCurrent);
Michael Kolb8233fac2010-10-26 16:08:53 -0700110
John Reck5949c662011-05-27 09:52:29 -0700111 Tab openTab(String url, Tab parent, boolean setActive,
112 boolean useCurrent);
113
Michael Kolbc831b632011-05-11 09:30:34 -0700114 boolean switchToTab(Tab tab);
Michael Kolb8233fac2010-10-26 16:08:53 -0700115
116 void closeTab(Tab tab);
117
Ben Murdoch8029a772010-11-16 11:58:21 +0000118 void setupAutoFill(Message message);
119
Leon Scroggins4cd97792010-12-03 15:31:56 -0500120 void bookmarkedStatusHasChanged(Tab tab);
121
John Reck1cf4b792011-07-26 10:22:22 -0700122 boolean shouldCaptureThumbnails();
Michael Kolb8233fac2010-10-26 16:08:53 -0700123}