mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-17 03:17:17 +01:00
77 lines
3.5 KiB
Java
77 lines
3.5 KiB
Java
package androidx.webkit.internal;
|
|
|
|
import android.webkit.ServiceWorkerController;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.webkit.ServiceWorkerClientCompat;
|
|
import androidx.webkit.ServiceWorkerControllerCompat;
|
|
import androidx.webkit.ServiceWorkerWebSettingsCompat;
|
|
import androidx.webkit.internal.ApiFeature;
|
|
import org.chromium.support_lib_boundary.ServiceWorkerControllerBoundaryInterface;
|
|
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes14.dex */
|
|
public class ServiceWorkerControllerImpl extends ServiceWorkerControllerCompat {
|
|
private ServiceWorkerControllerBoundaryInterface mBoundaryInterface;
|
|
private ServiceWorkerController mFrameworksImpl;
|
|
private final ServiceWorkerWebSettingsCompat mWebSettings;
|
|
|
|
public ServiceWorkerControllerImpl() {
|
|
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_BASIC_USAGE;
|
|
if (n.isSupportedByFramework()) {
|
|
this.mFrameworksImpl = ApiHelperForN.getServiceWorkerControllerInstance();
|
|
this.mBoundaryInterface = null;
|
|
this.mWebSettings = ApiHelperForN.getServiceWorkerWebSettingsImpl(getFrameworksImpl());
|
|
} else {
|
|
if (!n.isSupportedByWebView()) {
|
|
throw WebViewFeatureInternal.getUnsupportedOperationException();
|
|
}
|
|
this.mFrameworksImpl = null;
|
|
ServiceWorkerControllerBoundaryInterface serviceWorkerController = WebViewGlueCommunicator.getFactory().getServiceWorkerController();
|
|
this.mBoundaryInterface = serviceWorkerController;
|
|
this.mWebSettings = new ServiceWorkerWebSettingsImpl(serviceWorkerController.getServiceWorkerWebSettings());
|
|
}
|
|
}
|
|
|
|
private ServiceWorkerControllerBoundaryInterface getBoundaryInterface() {
|
|
if (this.mBoundaryInterface == null) {
|
|
this.mBoundaryInterface = WebViewGlueCommunicator.getFactory().getServiceWorkerController();
|
|
}
|
|
return this.mBoundaryInterface;
|
|
}
|
|
|
|
@RequiresApi(24)
|
|
private ServiceWorkerController getFrameworksImpl() {
|
|
if (this.mFrameworksImpl == null) {
|
|
this.mFrameworksImpl = ApiHelperForN.getServiceWorkerControllerInstance();
|
|
}
|
|
return this.mFrameworksImpl;
|
|
}
|
|
|
|
@Override // androidx.webkit.ServiceWorkerControllerCompat
|
|
public ServiceWorkerWebSettingsCompat getServiceWorkerWebSettings() {
|
|
return this.mWebSettings;
|
|
}
|
|
|
|
@Override // androidx.webkit.ServiceWorkerControllerCompat
|
|
public void setServiceWorkerClient(ServiceWorkerClientCompat serviceWorkerClientCompat) {
|
|
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_BASIC_USAGE;
|
|
if (n.isSupportedByFramework()) {
|
|
if (serviceWorkerClientCompat == null) {
|
|
ApiHelperForN.setServiceWorkerClient(getFrameworksImpl(), null);
|
|
return;
|
|
} else {
|
|
ApiHelperForN.setServiceWorkerClientCompat(getFrameworksImpl(), serviceWorkerClientCompat);
|
|
return;
|
|
}
|
|
}
|
|
if (!n.isSupportedByWebView()) {
|
|
throw WebViewFeatureInternal.getUnsupportedOperationException();
|
|
}
|
|
if (serviceWorkerClientCompat == null) {
|
|
getBoundaryInterface().setServiceWorkerClient(null);
|
|
} else {
|
|
getBoundaryInterface().setServiceWorkerClient(BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new ServiceWorkerClientAdapter(serviceWorkerClientCompat)));
|
|
}
|
|
}
|
|
}
|