WebViewFactoryProvider.java revision e1c6c3ae21a527c5ddb4386ceee51e9ebd4ad58f
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 17package android.webkit; 18 19import android.content.Context; 20 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 */ 27public interface WebViewFactoryProvider { 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); 45 46 /** 47 * Implements the API method: 48 * {@link android.webkit.WebSettings#getDefaultUserAgent(Context) } 49 */ 50 String getDefaultUserAgent(Context context); 51 52 /** 53 * Used for tests only. 54 */ 55 void freeMemoryForTests(); 56 57 /** 58 * Implements the API method: 59 * {@link android.webkit.WebView#setWebContentsDebuggingEnabled(boolean) } 60 */ 61 void setWebContentsDebuggingEnabled(boolean enable); 62 63 /** 64 * Implements the API method: 65 * {@link android.webkit.WebView#clearClientCertPreferences(Runnable) } 66 */ 67 void clearClientCertPreferences(Runnable onCleared); 68 69 } 70 71 Statics getStatics(); 72 73 /** 74 * Construct a new WebViewProvider. 75 * @param webView the WebView instance bound to this implementation instance. Note it will not 76 * necessarily be fully constructed at the point of this call: defer real initialization to 77 * WebViewProvider.init(). 78 * @param privateAccess provides access into WebView internal methods. 79 */ 80 WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess); 81 82 /** 83 * Gets the singleton GeolocationPermissions instance for this WebView implementation. The 84 * implementation must return the same instance on subsequent calls. 85 * @return the single GeolocationPermissions instance. 86 */ 87 GeolocationPermissions getGeolocationPermissions(); 88 89 /** 90 * Gets the singleton CookieManager instance for this WebView implementation. The 91 * implementation must return the same instance on subsequent calls. 92 * 93 * @return the singleton CookieManager instance 94 */ 95 CookieManager getCookieManager(); 96 97 /** 98 * Gets the singleton WebIconDatabase instance for this WebView implementation. The 99 * implementation must return the same instance on subsequent calls. 100 * 101 * @return the singleton WebIconDatabase instance 102 */ 103 WebIconDatabase getWebIconDatabase(); 104 105 /** 106 * Gets the singleton WebStorage instance for this WebView implementation. The 107 * implementation must return the same instance on subsequent calls. 108 * 109 * @return the singleton WebStorage instance 110 */ 111 WebStorage getWebStorage(); 112 113 /** 114 * Gets the singleton WebViewDatabase instance for this WebView implementation. The 115 * implementation must return the same instance on subsequent calls. 116 * 117 * @return the singleton WebViewDatabase instance 118 */ 119 WebViewDatabase getWebViewDatabase(Context context); 120} 121