From e149215027e947e6655edb889f48990e90dce609 Mon Sep 17 00:00:00 2001 From: Gustav Sennton Date: Thu, 22 Mar 2018 09:47:25 +0000 Subject: [WebView Support Library] Support service worker APIs. Provide (chromium-side) support for ServiceWorkers in the WebView Support Library. We'll add feature flags for the ServiceWorker APIs in a follow-up. Bug: 819595 Change-Id: Id4c79e3970706633e36b28538c443a00c7e59e03 Reviewed-on: https://chromium-review.googlesource.com/964142 Reviewed-by: Richard Coles Reviewed-by: Nate Fischer Commit-Queue: Gustav Sennton Cr-Original-Commit-Position: refs/heads/master@{#545024} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 824511444f1772442551af893e3e0fdeafed177a --- BUILD.gn | 3 +++ .../ServiceWorkerClientBoundaryInterface.java | 15 +++++++++++++ .../ServiceWorkerControllerBoundaryInterface.java | 15 +++++++++++++ .../ServiceWorkerWebSettingsBoundaryInterface.java | 26 ++++++++++++++++++++++ .../WebViewProviderFactoryBoundaryInterface.java | 1 + 5 files changed, 60 insertions(+) create mode 100644 src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java create mode 100644 src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java create mode 100644 src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java diff --git a/BUILD.gn b/BUILD.gn index dda7b79..9b36892 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -7,6 +7,9 @@ import("//build/config/android/rules.gni") android_library("boundary_interface_java") { java_files = [ + "src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java", + "src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java", + "src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java", "src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java", "src/org/chromium/support_lib_boundary/SupportLibraryInfoBoundaryInterface.java", "src/org/chromium/support_lib_boundary/VisualStateCallbackBoundaryInterface.java", diff --git a/src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java new file mode 100644 index 0000000..36a9cfc --- /dev/null +++ b/src/org/chromium/support_lib_boundary/ServiceWorkerClientBoundaryInterface.java @@ -0,0 +1,15 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import android.webkit.WebResourceRequest; +import android.webkit.WebResourceResponse; + +/** + * Boundary interface for ServiceWorkerClient. + */ +public interface ServiceWorkerClientBoundaryInterface { + WebResourceResponse shouldInterceptRequest(WebResourceRequest request); +} diff --git a/src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java new file mode 100644 index 0000000..e25e3ed --- /dev/null +++ b/src/org/chromium/support_lib_boundary/ServiceWorkerControllerBoundaryInterface.java @@ -0,0 +1,15 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +import java.lang.reflect.InvocationHandler; + +/** + * Boundary interface for ServiceWorkerController. + */ +public interface ServiceWorkerControllerBoundaryInterface { + /* ServiceWorkerWebSettings */ InvocationHandler getServiceWorkerWebSettings(); + void setServiceWorkerClient(/* ServiceWorkerClient */ InvocationHandler client); +} diff --git a/src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java b/src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java new file mode 100644 index 0000000..dfd61fa --- /dev/null +++ b/src/org/chromium/support_lib_boundary/ServiceWorkerWebSettingsBoundaryInterface.java @@ -0,0 +1,26 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.support_lib_boundary; + +/** + * Boundary interface for ServiceWorkerWebSettings. + */ +public interface ServiceWorkerWebSettingsBoundaryInterface { + void setCacheMode(int mode); + + int getCacheMode(); + + void setAllowContentAccess(boolean allow); + + boolean getAllowContentAccess(); + + void setAllowFileAccess(boolean allow); + + boolean getAllowFileAccess(); + + void setBlockNetworkLoads(boolean flag); + + boolean getBlockNetworkLoads(); +} diff --git a/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java b/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java index 094e2cf..380bf42 100644 --- a/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java +++ b/src/org/chromium/support_lib_boundary/WebViewProviderFactoryBoundaryInterface.java @@ -15,4 +15,5 @@ public interface WebViewProviderFactoryBoundaryInterface { /* SupportLibWebkitToCompatConverter */ InvocationHandler getWebkitToCompatConverter(); /* StaticsAdapter */ InvocationHandler getStatics(); String[] getSupportedFeatures(); + /* SupportLibraryServiceWorkerController */ InvocationHandler getServiceWorkerController(); } -- cgit v1.2.3