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