Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 1 | /* |
| 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 Amirzada | 41242f2 | 2014-03-21 12:12:18 -0700 | [diff] [blame^] | 17 | package com.android.browser; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 18 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 19 | import android.app.Activity; |
Michael Kolb | 1461244 | 2011-06-24 13:06:29 -0700 | [diff] [blame] | 20 | import android.content.Context; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 21 | import android.graphics.Bitmap; |
| 22 | import android.net.Uri; |
| 23 | import android.net.http.SslError; |
Ben Murdoch | 8029a77 | 2010-11-16 11:58:21 +0000 | [diff] [blame] | 24 | import android.os.Message; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 25 | import android.view.KeyEvent; |
| 26 | import android.view.View; |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 27 | import org.codeaurora.swe.HttpAuthHandler; |
| 28 | import org.codeaurora.swe.SslErrorHandler; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 29 | import android.webkit.ValueCallback; |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 30 | import android.webkit.WebChromeClient.CustomViewCallback; |
| 31 | import org.codeaurora.swe.WebChromeClient; |
| 32 | import org.codeaurora.swe.WebView; |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 33 | |
Michael Kolb | 11d1978 | 2011-03-20 10:17:40 -0700 | [diff] [blame] | 34 | import java.util.List; |
| 35 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 36 | /** |
| 37 | * WebView aspect of the controller |
| 38 | */ |
| 39 | public interface WebViewController { |
| 40 | |
Michael Kolb | 1461244 | 2011-06-24 13:06:29 -0700 | [diff] [blame] | 41 | Context getContext(); |
| 42 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 43 | Activity getActivity(); |
| 44 | |
| 45 | TabControl getTabControl(); |
| 46 | |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 47 | WebViewFactory getWebViewFactory(); |
| 48 | |
Michael Kolb | a713ec8 | 2010-11-29 17:27:06 -0800 | [diff] [blame] | 49 | void onSetWebView(Tab tab, WebView view); |
| 50 | |
Michael Kolb | 1514bb7 | 2010-11-22 09:11:48 -0800 | [diff] [blame] | 51 | void createSubWindow(Tab tab); |
| 52 | |
John Reck | 324d440 | 2011-01-11 16:56:42 -0800 | [diff] [blame] | 53 | void onPageStarted(Tab tab, WebView view, Bitmap favicon); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 54 | |
John Reck | 324d440 | 2011-01-11 16:56:42 -0800 | [diff] [blame] | 55 | void onPageFinished(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 56 | |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 57 | void onProgressChanged(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 58 | |
| 59 | void onReceivedTitle(Tab tab, final String title); |
| 60 | |
| 61 | void onFavicon(Tab tab, WebView view, Bitmap icon); |
| 62 | |
Michael Kolb | 18eb377 | 2010-12-10 14:29:51 -0800 | [diff] [blame] | 63 | boolean shouldOverrideUrlLoading(Tab tab, WebView view, String url); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 64 | |
| 65 | boolean shouldOverrideKeyEvent(KeyEvent event); |
| 66 | |
John Reck | 997b1b7 | 2012-04-19 18:08:25 -0700 | [diff] [blame] | 67 | boolean onUnhandledKeyEvent(KeyEvent event); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 68 | |
John Reck | 324d440 | 2011-01-11 16:56:42 -0800 | [diff] [blame] | 69 | void doUpdateVisitedHistory(Tab tab, boolean isReload); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 70 | |
| 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 Gurun | 0b3d66f | 2012-08-29 13:08:13 -0700 | [diff] [blame] | 77 | String mimeType, String referer, long contentLength); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 78 | |
Michael Kolb | 1461244 | 2011-06-24 13:06:29 -0700 | [diff] [blame] | 79 | void showCustomView(Tab tab, View view, int requestedOrientation, |
Bijan Amirzada | 9b1e988 | 2014-02-26 17:15:46 -0800 | [diff] [blame] | 80 | CustomViewCallback callback); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 81 | |
| 82 | void hideCustomView(); |
| 83 | |
| 84 | Bitmap getDefaultVideoPoster(); |
| 85 | |
| 86 | View getVideoLoadingProgressView(); |
| 87 | |
| 88 | void showSslCertificateOnError(WebView view, SslErrorHandler handler, |
| 89 | SslError error); |
| 90 | |
John Reck | 30c714c | 2010-12-16 17:30:34 -0800 | [diff] [blame] | 91 | void onUserCanceledSsl(Tab tab); |
| 92 | |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 93 | boolean shouldShowErrorConsole(); |
| 94 | |
Steve Block | 2466eff | 2011-10-03 15:33:09 +0100 | [diff] [blame] | 95 | void onUpdatedSecurityState(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 96 | |
Ben Murdoch | 8cad413 | 2012-01-11 10:56:43 +0000 | [diff] [blame] | 97 | void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 98 | |
| 99 | void endActionMode(); |
| 100 | |
| 101 | void attachSubWindow(Tab tab); |
| 102 | |
| 103 | void dismissSubWindow(Tab tab); |
| 104 | |
Michael Kolb | 7bcafde | 2011-05-09 13:55:59 -0700 | [diff] [blame] | 105 | Tab openTab(String url, boolean incognito, boolean setActive, |
| 106 | boolean useCurrent); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 107 | |
John Reck | 5949c66 | 2011-05-27 09:52:29 -0700 | [diff] [blame] | 108 | Tab openTab(String url, Tab parent, boolean setActive, |
| 109 | boolean useCurrent); |
| 110 | |
Michael Kolb | c831b63 | 2011-05-11 09:30:34 -0700 | [diff] [blame] | 111 | boolean switchToTab(Tab tab); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 112 | |
| 113 | void closeTab(Tab tab); |
| 114 | |
Ben Murdoch | 8029a77 | 2010-11-16 11:58:21 +0000 | [diff] [blame] | 115 | void setupAutoFill(Message message); |
| 116 | |
Leon Scroggins | 4cd9779 | 2010-12-03 15:31:56 -0500 | [diff] [blame] | 117 | void bookmarkedStatusHasChanged(Tab tab); |
| 118 | |
Patrick Scott | 9206677 | 2011-03-10 08:46:27 -0500 | [diff] [blame] | 119 | void showAutoLogin(Tab tab); |
| 120 | |
| 121 | void hideAutoLogin(Tab tab); |
John Reck | 1cf4b79 | 2011-07-26 10:22:22 -0700 | [diff] [blame] | 122 | |
| 123 | boolean shouldCaptureThumbnails(); |
Michael Kolb | 8233fac | 2010-10-26 16:08:53 -0700 | [diff] [blame] | 124 | } |