13c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon/* 23c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * Copyright (C) 2012 The Android Open Source Project 33c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * 43c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * Licensed under the Apache License, Version 2.0 (the "License"); 53c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * you may not use this file except in compliance with the License. 63c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * You may obtain a copy of the License at 73c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * 83c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * http://www.apache.org/licenses/LICENSE-2.0 93c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * 103c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * Unless required by applicable law or agreed to in writing, software 113c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * distributed under the License is distributed on an "AS IS" BASIS, 123c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 133c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * See the License for the specific language governing permissions and 143c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * limitations under the License. 153c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon */ 163c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon 173c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixonpackage android.webkit; 183c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon 19451e338c51e8c45efc0d21536dfae6f78f6d5e06Ignacio Sollaimport android.annotation.SystemApi; 2099c12e8d5f12f239c28644a837937810299e5e3fBen Murdochimport android.content.Context; 21e8df27aec8367f8718c03059af679049fc522d9cTao Baiimport android.content.Intent; 22e8df27aec8367f8718c03059af679049fc522d9cTao Baiimport android.net.Uri; 2399c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch 243c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon/** 253c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * This is the main entry-point into the WebView back end implementations, which the WebView 263c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * proxy class uses to instantiate all the other objects as needed. The backend must provide an 273c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * implementation of this interface, and make it available to the WebView via mechanism TBD. 283c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * @hide 293c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon */ 30451e338c51e8c45efc0d21536dfae6f78f6d5e06Ignacio Solla@SystemApi 313c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixonpublic interface WebViewFactoryProvider { 323c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon /** 333c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * This Interface provides glue for implementing the backend of WebView static methods which 343c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * cannot be implemented in-situ in the proxy class. 353c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon */ 363c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon interface Statics { 373c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon /** 383c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * Implements the API method: 393c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon * {@link android.webkit.WebView#findAddress(String)} 403c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon */ 413c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon String findAddress(String addr); 423c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon 433c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon /** 44d1c4faa5a4c2be71d529d35572c5f807beee7ddcJonathan Dixon * Implements the API method: 45d1c4faa5a4c2be71d529d35572c5f807beee7ddcJonathan Dixon * {@link android.webkit.WebSettings#getDefaultUserAgent(Context) } 46d1c4faa5a4c2be71d529d35572c5f807beee7ddcJonathan Dixon */ 47d1c4faa5a4c2be71d529d35572c5f807beee7ddcJonathan Dixon String getDefaultUserAgent(Context context); 48244267500254daff8745f8c0fae3edcac735873fPrimiano Tucci 49244267500254daff8745f8c0fae3edcac735873fPrimiano Tucci /** 50244267500254daff8745f8c0fae3edcac735873fPrimiano Tucci * Used for tests only. 51244267500254daff8745f8c0fae3edcac735873fPrimiano Tucci */ 52244267500254daff8745f8c0fae3edcac735873fPrimiano Tucci void freeMemoryForTests(); 5390102e2ccc62e82382b1e0094a47e1516e1b9e36Jonathan Dixon 5490102e2ccc62e82382b1e0094a47e1516e1b9e36Jonathan Dixon /** 55057989eddc709883794b6a3c311c43aba11084eeMikhail Naganov * Implements the API method: 56057989eddc709883794b6a3c311c43aba11084eeMikhail Naganov * {@link android.webkit.WebView#setWebContentsDebuggingEnabled(boolean) } 57057989eddc709883794b6a3c311c43aba11084eeMikhail Naganov */ 58057989eddc709883794b6a3c311c43aba11084eeMikhail Naganov void setWebContentsDebuggingEnabled(boolean enable); 59e1c6c3ae21a527c5ddb4386ceee51e9ebd4ad58fSelim Gurun 60e1c6c3ae21a527c5ddb4386ceee51e9ebd4ad58fSelim Gurun /** 61e1c6c3ae21a527c5ddb4386ceee51e9ebd4ad58fSelim Gurun * Implements the API method: 62e1c6c3ae21a527c5ddb4386ceee51e9ebd4ad58fSelim Gurun * {@link android.webkit.WebView#clearClientCertPreferences(Runnable) } 63e1c6c3ae21a527c5ddb4386ceee51e9ebd4ad58fSelim Gurun */ 64e1c6c3ae21a527c5ddb4386ceee51e9ebd4ad58fSelim Gurun void clearClientCertPreferences(Runnable onCleared); 65e1c6c3ae21a527c5ddb4386ceee51e9ebd4ad58fSelim Gurun 667871554e1abe81d745a93c9a97f679f6617f906dSelim Gurun /** 677871554e1abe81d745a93c9a97f679f6617f906dSelim Gurun * Implements the API method: 689f3ed850b6521bec8a946a54bb8a15565b4aa67eBo Liu * {@link android.webkit.WebView#setSlowWholeDocumentDrawEnabled(boolean) } 699f3ed850b6521bec8a946a54bb8a15565b4aa67eBo Liu */ 709f3ed850b6521bec8a946a54bb8a15565b4aa67eBo Liu void enableSlowWholeDocumentDraw(); 71e8df27aec8367f8718c03059af679049fc522d9cTao Bai 72e8df27aec8367f8718c03059af679049fc522d9cTao Bai /** 73e8df27aec8367f8718c03059af679049fc522d9cTao Bai * Implement the API method 74e8df27aec8367f8718c03059af679049fc522d9cTao Bai * {@link android.webkit.WebChromeClient.FileChooserParams#parseResult(int, Intent)} 75e8df27aec8367f8718c03059af679049fc522d9cTao Bai */ 76e8df27aec8367f8718c03059af679049fc522d9cTao Bai Uri[] parseFileChooserResult(int resultCode, Intent intent); 773c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon } 78d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon 79d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon Statics getStatics(); 80d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon 81d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon /** 82d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * Construct a new WebViewProvider. 83d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * @param webView the WebView instance bound to this implementation instance. Note it will not 84d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * necessarily be fully constructed at the point of this call: defer real initialization to 85d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * WebViewProvider.init(). 86d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * @param privateAccess provides access into WebView internal methods. 87d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon */ 88d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess); 89d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon 90d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon /** 91d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * Gets the singleton GeolocationPermissions instance for this WebView implementation. The 92d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * implementation must return the same instance on subsequent calls. 93d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * @return the single GeolocationPermissions instance. 94d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon */ 95d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon GeolocationPermissions getGeolocationPermissions(); 96d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon 97d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon /** 98d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * Gets the singleton CookieManager instance for this WebView implementation. The 99d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * implementation must return the same instance on subsequent calls. 10099c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * 10199c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * @return the singleton CookieManager instance 102d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon */ 103d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon CookieManager getCookieManager(); 104d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon 105d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon /** 106504b81b02c428bbb59ca1704d653d0897e25c370Selim Gurun * Gets the TokenBindingService instance for this WebView implementation. The 107504b81b02c428bbb59ca1704d653d0897e25c370Selim Gurun * implementation must return the same instance on subsequent calls. 108504b81b02c428bbb59ca1704d653d0897e25c370Selim Gurun * 109504b81b02c428bbb59ca1704d653d0897e25c370Selim Gurun * @return the TokenBindingService instance 110504b81b02c428bbb59ca1704d653d0897e25c370Selim Gurun */ 111504b81b02c428bbb59ca1704d653d0897e25c370Selim Gurun TokenBindingService getTokenBindingService(); 112504b81b02c428bbb59ca1704d653d0897e25c370Selim Gurun 113504b81b02c428bbb59ca1704d653d0897e25c370Selim Gurun /** 11428c83564419de9f4f3d22aff630244dc4cbc3c2fTim Volodine * Gets the ServiceWorkerController instance for this WebView implementation. The 11528c83564419de9f4f3d22aff630244dc4cbc3c2fTim Volodine * implementation must return the same instance on subsequent calls. 11628c83564419de9f4f3d22aff630244dc4cbc3c2fTim Volodine * 11728c83564419de9f4f3d22aff630244dc4cbc3c2fTim Volodine * @return the ServiceWorkerController instance 11828c83564419de9f4f3d22aff630244dc4cbc3c2fTim Volodine */ 11928c83564419de9f4f3d22aff630244dc4cbc3c2fTim Volodine ServiceWorkerController getServiceWorkerController(); 12028c83564419de9f4f3d22aff630244dc4cbc3c2fTim Volodine 12128c83564419de9f4f3d22aff630244dc4cbc3c2fTim Volodine /** 122d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * Gets the singleton WebIconDatabase instance for this WebView implementation. The 123d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * implementation must return the same instance on subsequent calls. 12499c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * 12599c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * @return the singleton WebIconDatabase instance 126d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon */ 127d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon WebIconDatabase getWebIconDatabase(); 128d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon 129d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon /** 130d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * Gets the singleton WebStorage instance for this WebView implementation. The 131d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon * implementation must return the same instance on subsequent calls. 13299c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * 13399c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * @return the singleton WebStorage instance 134d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon */ 135d3101b1d300f5942fdb7dfa323dc8830c4edc007Jonathan Dixon WebStorage getWebStorage(); 13699c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch 13799c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch /** 13899c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * Gets the singleton WebViewDatabase instance for this WebView implementation. The 13999c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * implementation must return the same instance on subsequent calls. 14099c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * 14199c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch * @return the singleton WebViewDatabase instance 14299c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch */ 14399c12e8d5f12f239c28644a837937810299e5e3fBen Murdoch WebViewDatabase getWebViewDatabase(Context context); 1443c90952036a5ff7ddb2946c643f1a0bf1c31d53aJonathan Dixon} 145