1 /* 2 * Copyright 2018 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 androidx.webkit.internal; 18 19 import android.webkit.TracingController; 20 import android.webkit.WebView; 21 22 import androidx.webkit.WebViewCompat; 23 import androidx.webkit.WebViewStartUpConfig; 24 25 import org.chromium.support_lib_boundary.DropDataContentProviderBoundaryInterface; 26 import org.chromium.support_lib_boundary.ProfileStoreBoundaryInterface; 27 import org.chromium.support_lib_boundary.ProxyControllerBoundaryInterface; 28 import org.chromium.support_lib_boundary.ServiceWorkerControllerBoundaryInterface; 29 import org.chromium.support_lib_boundary.StaticsBoundaryInterface; 30 import org.chromium.support_lib_boundary.TracingControllerBoundaryInterface; 31 import org.chromium.support_lib_boundary.WebViewProviderBoundaryInterface; 32 import org.chromium.support_lib_boundary.WebkitToCompatConverterBoundaryInterface; 33 import org.jspecify.annotations.NonNull; 34 35 /** 36 * Interface representing {@link android.webkit.WebViewFactoryProvider}. 37 * On device with a compatible WebView APK this interface is implemented by a class defined in the 38 * WebView APK itself. 39 * On devices without a compatible WebView APK this interface is implemented by a stub class 40 * {@link androidx.webkit.internal.IncompatibleApkWebViewProviderFactory}. 41 */ 42 @SuppressWarnings("JavadocReference") // WebViewFactoryProvider and WebViewProvider are hidden. 43 public interface WebViewProviderFactory { 44 /** 45 * Create a support library version of {@link android.webkit.WebViewProvider}. 46 */ createWebView(@onNull WebView webview)47 @NonNull WebViewProviderBoundaryInterface createWebView(@NonNull WebView webview); 48 49 /** 50 * Create the boundary interface for {@link WebkitToCompatConverter} 51 * which converts android.webkit classes into their corresponding support library classes. 52 */ getWebkitToCompatConverter()53 @NonNull WebkitToCompatConverterBoundaryInterface getWebkitToCompatConverter(); 54 55 /** 56 * Fetch the boundary interface representing 57 * {@link android.webkit.WebViewFactoryProvider#Statics}. 58 */ getStatics()59 @NonNull StaticsBoundaryInterface getStatics(); 60 61 /** 62 * Fetch the features supported by the current WebView APK. 63 */ getWebViewFeatures()64 String @NonNull [] getWebViewFeatures(); 65 66 /** 67 * Fetch the boundary interface representing {@link android.webkit.ServiceWorkerController}. 68 */ getServiceWorkerController()69 @NonNull ServiceWorkerControllerBoundaryInterface getServiceWorkerController(); 70 71 /** 72 * Fetch the boundary interface representing {@link TracingController}. 73 */ getTracingController()74 @NonNull TracingControllerBoundaryInterface getTracingController(); 75 76 /** 77 * Fetch the boundary interface representing {@link android.webkit.ProxyController}. 78 */ getProxyController()79 @NonNull ProxyControllerBoundaryInterface getProxyController(); 80 81 /** 82 * Fetch the boundary interface representing image drag drop implementation. 83 */ getDropDataProvider()84 @NonNull DropDataContentProviderBoundaryInterface getDropDataProvider(); 85 86 /** 87 * Fetch the boundary interface representing profile store for Multi-Profile. 88 */ getProfileStore()89 @NonNull ProfileStoreBoundaryInterface getProfileStore(); 90 91 /** 92 * Fetch the boundary interface representing 93 * {@link WebViewCompat#startUpWebView(WebViewStartUpConfig, WebViewCompat.WebViewStartUpCallback)}. 94 */ startUpWebView(@onNull WebViewStartUpConfig config, WebViewCompat.@NonNull WebViewStartUpCallback callback)95 void startUpWebView(@NonNull WebViewStartUpConfig config, 96 WebViewCompat.@NonNull WebViewStartUpCallback callback); 97 } 98