blob: 4ff49ea1bbc310a12a79e19bf52e4cdeb1221fe8 [file] [log] [blame]
Jonathan Dixon3c909522012-02-28 18:45:06 +00001/*
2 * Copyright (C) 2012 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 android.webkit;
18
Nate Fischer3898ac12017-08-09 23:02:36 -070019import android.annotation.NonNull;
Ignacio Solla451e3382014-11-10 10:35:54 +000020import android.annotation.SystemApi;
Ben Murdoch99c12e82012-04-25 15:00:17 +010021import android.content.Context;
Tao Baie8df27a2014-09-02 14:09:49 -070022import android.content.Intent;
23import android.net.Uri;
Ben Murdoch99c12e82012-04-25 15:00:17 +010024
Nate Fischer520a8ba2017-07-12 17:37:07 -070025import java.util.List;
26
Jonathan Dixon3c909522012-02-28 18:45:06 +000027/**
28 * This is the main entry-point into the WebView back end implementations, which the WebView
29 * proxy class uses to instantiate all the other objects as needed. The backend must provide an
30 * implementation of this interface, and make it available to the WebView via mechanism TBD.
31 * @hide
32 */
Ignacio Solla451e3382014-11-10 10:35:54 +000033@SystemApi
Jonathan Dixon3c909522012-02-28 18:45:06 +000034public interface WebViewFactoryProvider {
Jonathan Dixon3c909522012-02-28 18:45:06 +000035 /**
36 * This Interface provides glue for implementing the backend of WebView static methods which
37 * cannot be implemented in-situ in the proxy class.
38 */
39 interface Statics {
40 /**
41 * Implements the API method:
42 * {@link android.webkit.WebView#findAddress(String)}
43 */
44 String findAddress(String addr);
45
46 /**
Jonathan Dixond1c4faa2012-08-20 16:37:15 -070047 * Implements the API method:
48 * {@link android.webkit.WebSettings#getDefaultUserAgent(Context) }
49 */
50 String getDefaultUserAgent(Context context);
Primiano Tucci24426752013-09-05 12:01:51 +010051
52 /**
53 * Used for tests only.
54 */
55 void freeMemoryForTests();
Jonathan Dixon90102e22013-09-21 10:47:22 -070056
57 /**
Mikhail Naganov057989e2013-09-06 16:35:25 -070058 * Implements the API method:
59 * {@link android.webkit.WebView#setWebContentsDebuggingEnabled(boolean) }
60 */
61 void setWebContentsDebuggingEnabled(boolean enable);
Selim Gurune1c6c3a2014-04-28 14:21:21 -070062
63 /**
64 * Implements the API method:
65 * {@link android.webkit.WebView#clearClientCertPreferences(Runnable) }
66 */
67 void clearClientCertPreferences(Runnable onCleared);
68
Selim Gurun78715542014-07-09 14:40:13 -070069 /**
70 * Implements the API method:
Bo Liu9f3ed852014-07-18 10:03:12 -070071 * {@link android.webkit.WebView#setSlowWholeDocumentDrawEnabled(boolean) }
72 */
73 void enableSlowWholeDocumentDraw();
Tao Baie8df27a2014-09-02 14:09:49 -070074
75 /**
76 * Implement the API method
77 * {@link android.webkit.WebChromeClient.FileChooserParams#parseResult(int, Intent)}
78 */
79 Uri[] parseFileChooserResult(int resultCode, Intent intent);
Nate Fischer0e72c182017-05-30 11:25:17 -070080
81 /**
82 * Implement the API method
Nate Fischer2b108d82017-08-21 17:59:55 -070083 * {@link android.webkit.WebView#startSafeBrowsing(Context , ValueCallback<Boolean>)}
Nate Fischer0e72c182017-05-30 11:25:17 -070084 */
Jeff Sharkey90396362017-06-12 16:26:53 -060085 void initSafeBrowsing(Context context, ValueCallback<Boolean> callback);
Nate Fischer0e72c182017-05-30 11:25:17 -070086
87 /**
Nate Fischerbf158ec2017-06-27 22:52:20 -070088 * Implement the API method
Nate Fischerd6385d32017-07-17 12:58:18 -070089 * {@link android.webkit.WebView#setSafeBrowsingWhitelist(List<String>,
90 * ValueCallback<Boolean>)}
Nate Fischerbf158ec2017-06-27 22:52:20 -070091 */
Nate Fischer5a6ae8c2018-02-21 15:27:01 -080092 void setSafeBrowsingWhitelist(List<String> hosts, ValueCallback<Boolean> callback);
Nate Fischer3898ac12017-08-09 23:02:36 -070093
94 /**
95 * Implement the API method
96 * {@link android.webkit.WebView#getSafeBrowsingPrivacyPolicyUrl()}
97 */
98 @NonNull
99 Uri getSafeBrowsingPrivacyPolicyUrl();
Jonathan Dixon3c909522012-02-28 18:45:06 +0000100 }
Jonathan Dixond3101b12012-04-12 20:51:51 +0100101
102 Statics getStatics();
103
104 /**
105 * Construct a new WebViewProvider.
106 * @param webView the WebView instance bound to this implementation instance. Note it will not
107 * necessarily be fully constructed at the point of this call: defer real initialization to
108 * WebViewProvider.init().
109 * @param privateAccess provides access into WebView internal methods.
110 */
111 WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess);
112
113 /**
114 * Gets the singleton GeolocationPermissions instance for this WebView implementation. The
115 * implementation must return the same instance on subsequent calls.
116 * @return the single GeolocationPermissions instance.
117 */
118 GeolocationPermissions getGeolocationPermissions();
119
120 /**
121 * Gets the singleton CookieManager instance for this WebView implementation. The
122 * implementation must return the same instance on subsequent calls.
Ben Murdoch99c12e82012-04-25 15:00:17 +0100123 *
124 * @return the singleton CookieManager instance
Jonathan Dixond3101b12012-04-12 20:51:51 +0100125 */
126 CookieManager getCookieManager();
127
128 /**
Selim Gurun504b81b2016-01-15 21:10:52 +0000129 * Gets the TokenBindingService instance for this WebView implementation. The
130 * implementation must return the same instance on subsequent calls.
131 *
132 * @return the TokenBindingService instance
Selim Gurun504b81b2016-01-15 21:10:52 +0000133 */
134 TokenBindingService getTokenBindingService();
135
136 /**
Tim Volodinec8095422017-11-10 21:07:36 +0000137 * Gets the TracingController instance for this WebView implementation. The
138 * implementation must return the same instance on subsequent calls.
139 *
140 * @return the TracingController instance
141 */
142 TracingController getTracingController();
143
144 /**
Tim Volodine28c83562016-01-20 19:23:03 +0000145 * Gets the ServiceWorkerController instance for this WebView implementation. The
146 * implementation must return the same instance on subsequent calls.
147 *
148 * @return the ServiceWorkerController instance
149 */
150 ServiceWorkerController getServiceWorkerController();
151
152 /**
Jonathan Dixond3101b12012-04-12 20:51:51 +0100153 * Gets the singleton WebIconDatabase instance for this WebView implementation. The
154 * implementation must return the same instance on subsequent calls.
Ben Murdoch99c12e82012-04-25 15:00:17 +0100155 *
156 * @return the singleton WebIconDatabase instance
Jonathan Dixond3101b12012-04-12 20:51:51 +0100157 */
158 WebIconDatabase getWebIconDatabase();
159
160 /**
161 * Gets the singleton WebStorage instance for this WebView implementation. The
162 * implementation must return the same instance on subsequent calls.
Ben Murdoch99c12e82012-04-25 15:00:17 +0100163 *
164 * @return the singleton WebStorage instance
Jonathan Dixond3101b12012-04-12 20:51:51 +0100165 */
166 WebStorage getWebStorage();
Ben Murdoch99c12e82012-04-25 15:00:17 +0100167
168 /**
169 * Gets the singleton WebViewDatabase instance for this WebView implementation. The
170 * implementation must return the same instance on subsequent calls.
171 *
172 * @return the singleton WebViewDatabase instance
173 */
174 WebViewDatabase getWebViewDatabase(Context context);
Gustav Sennton265afdb2018-01-19 11:56:55 +0000175
176 /**
177 * Gets the classloader used to load internal WebView implementation classes. This interface
178 * should only be used by the WebView Support Library.
179 */
180 ClassLoader getWebViewClassLoader();
Jonathan Dixon3c909522012-02-28 18:45:06 +0000181}