Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.webkit; |
| 18 | |
Ben Murdoch | 99c12e8 | 2012-04-25 15:00:17 +0100 | [diff] [blame] | 19 | import android.content.Context; |
| 20 | |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 21 | /** |
| 22 | * This is the main entry-point into the WebView back end implementations, which the WebView |
| 23 | * proxy class uses to instantiate all the other objects as needed. The backend must provide an |
| 24 | * implementation of this interface, and make it available to the WebView via mechanism TBD. |
| 25 | * @hide |
| 26 | */ |
| 27 | public interface WebViewFactoryProvider { |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 28 | /** |
| 29 | * This Interface provides glue for implementing the backend of WebView static methods which |
| 30 | * cannot be implemented in-situ in the proxy class. |
| 31 | */ |
| 32 | interface Statics { |
| 33 | /** |
| 34 | * Implements the API method: |
| 35 | * {@link android.webkit.WebView#findAddress(String)} |
| 36 | */ |
| 37 | String findAddress(String addr); |
| 38 | |
| 39 | /** |
| 40 | * Implements the API methods: |
| 41 | * {@link android.webkit.WebView#enablePlatformNotifications()} |
| 42 | * {@link android.webkit.WebView#disablePlatformNotifications()} |
| 43 | */ |
| 44 | void setPlatformNotificationsEnabled(boolean enable); |
Jonathan Dixon | d1c4faa | 2012-08-20 16:37:15 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * Implements the API method: |
| 48 | * {@link android.webkit.WebSettings#getDefaultUserAgent(Context) } |
| 49 | */ |
| 50 | String getDefaultUserAgent(Context context); |
Primiano Tucci | 2442675 | 2013-09-05 12:01:51 +0100 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * Used for tests only. |
| 54 | */ |
| 55 | void freeMemoryForTests(); |
Jonathan Dixon | 90102e2 | 2013-09-21 10:47:22 -0700 | [diff] [blame] | 56 | |
| 57 | /** |
Mikhail Naganov | 057989e | 2013-09-06 16:35:25 -0700 | [diff] [blame] | 58 | * Implements the API method: |
| 59 | * {@link android.webkit.WebView#setWebContentsDebuggingEnabled(boolean) } |
| 60 | */ |
| 61 | void setWebContentsDebuggingEnabled(boolean enable); |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 62 | } |
Jonathan Dixon | d3101b1 | 2012-04-12 20:51:51 +0100 | [diff] [blame] | 63 | |
| 64 | Statics getStatics(); |
| 65 | |
| 66 | /** |
| 67 | * Construct a new WebViewProvider. |
| 68 | * @param webView the WebView instance bound to this implementation instance. Note it will not |
| 69 | * necessarily be fully constructed at the point of this call: defer real initialization to |
| 70 | * WebViewProvider.init(). |
| 71 | * @param privateAccess provides access into WebView internal methods. |
| 72 | */ |
| 73 | WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess); |
| 74 | |
| 75 | /** |
| 76 | * Gets the singleton GeolocationPermissions instance for this WebView implementation. The |
| 77 | * implementation must return the same instance on subsequent calls. |
| 78 | * @return the single GeolocationPermissions instance. |
| 79 | */ |
| 80 | GeolocationPermissions getGeolocationPermissions(); |
| 81 | |
| 82 | /** |
| 83 | * Gets the singleton CookieManager instance for this WebView implementation. The |
| 84 | * implementation must return the same instance on subsequent calls. |
Ben Murdoch | 99c12e8 | 2012-04-25 15:00:17 +0100 | [diff] [blame] | 85 | * |
| 86 | * @return the singleton CookieManager instance |
Jonathan Dixon | d3101b1 | 2012-04-12 20:51:51 +0100 | [diff] [blame] | 87 | */ |
| 88 | CookieManager getCookieManager(); |
| 89 | |
| 90 | /** |
| 91 | * Gets the singleton WebIconDatabase instance for this WebView implementation. The |
| 92 | * implementation must return the same instance on subsequent calls. |
Ben Murdoch | 99c12e8 | 2012-04-25 15:00:17 +0100 | [diff] [blame] | 93 | * |
| 94 | * @return the singleton WebIconDatabase instance |
Jonathan Dixon | d3101b1 | 2012-04-12 20:51:51 +0100 | [diff] [blame] | 95 | */ |
| 96 | WebIconDatabase getWebIconDatabase(); |
| 97 | |
| 98 | /** |
| 99 | * Gets the singleton WebStorage instance for this WebView implementation. The |
| 100 | * implementation must return the same instance on subsequent calls. |
Ben Murdoch | 99c12e8 | 2012-04-25 15:00:17 +0100 | [diff] [blame] | 101 | * |
| 102 | * @return the singleton WebStorage instance |
Jonathan Dixon | d3101b1 | 2012-04-12 20:51:51 +0100 | [diff] [blame] | 103 | */ |
| 104 | WebStorage getWebStorage(); |
Ben Murdoch | 99c12e8 | 2012-04-25 15:00:17 +0100 | [diff] [blame] | 105 | |
| 106 | /** |
| 107 | * Gets the singleton WebViewDatabase instance for this WebView implementation. The |
| 108 | * implementation must return the same instance on subsequent calls. |
| 109 | * |
| 110 | * @return the singleton WebViewDatabase instance |
| 111 | */ |
| 112 | WebViewDatabase getWebViewDatabase(Context context); |
Jonathan Dixon | 3c90952 | 2012-02-28 18:45:06 +0000 | [diff] [blame] | 113 | } |