- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
81 lines
3.6 KiB
Java
81 lines
3.6 KiB
Java
package androidx.webkit.internal;
|
|
|
|
import android.webkit.ServiceWorkerController;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
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;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ServiceWorkerControllerImpl extends ServiceWorkerControllerCompat {
|
|
private ServiceWorkerControllerBoundaryInterface mBoundaryInterface;
|
|
private ServiceWorkerController mFrameworksImpl;
|
|
private final ServiceWorkerWebSettingsCompat mWebSettings;
|
|
|
|
@Override // androidx.webkit.ServiceWorkerControllerCompat
|
|
@NonNull
|
|
public ServiceWorkerWebSettingsCompat getServiceWorkerWebSettings() {
|
|
return this.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()) {
|
|
this.mFrameworksImpl = null;
|
|
ServiceWorkerControllerBoundaryInterface serviceWorkerController = WebViewGlueCommunicator.getFactory().getServiceWorkerController();
|
|
this.mBoundaryInterface = serviceWorkerController;
|
|
this.mWebSettings = new ServiceWorkerWebSettingsImpl(serviceWorkerController.getServiceWorkerWebSettings());
|
|
return;
|
|
}
|
|
throw WebViewFeatureInternal.getUnsupportedOperationException();
|
|
}
|
|
}
|
|
|
|
@RequiresApi(24)
|
|
private ServiceWorkerController getFrameworksImpl() {
|
|
if (this.mFrameworksImpl == null) {
|
|
this.mFrameworksImpl = ApiHelperForN.getServiceWorkerControllerInstance();
|
|
}
|
|
return this.mFrameworksImpl;
|
|
}
|
|
|
|
private ServiceWorkerControllerBoundaryInterface getBoundaryInterface() {
|
|
if (this.mBoundaryInterface == null) {
|
|
this.mBoundaryInterface = WebViewGlueCommunicator.getFactory().getServiceWorkerController();
|
|
}
|
|
return this.mBoundaryInterface;
|
|
}
|
|
|
|
@Override // androidx.webkit.ServiceWorkerControllerCompat
|
|
public void setServiceWorkerClient(@Nullable 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)));
|
|
}
|
|
}
|
|
}
|