[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 <torne@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Commit-Queue: Gustav Sennton <gsennton@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#545024}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 824511444f1772442551af893e3e0fdeafed177a
diff --git a/BUILD.gn b/BUILD.gn
index dda7b79..9b36892 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -7,6 +7,9 @@
 
 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 @@
     /* SupportLibWebkitToCompatConverter */ InvocationHandler getWebkitToCompatConverter();
     /* StaticsAdapter */ InvocationHandler getStatics();
     String[] getSupportedFeatures();
+    /* SupportLibraryServiceWorkerController */ InvocationHandler getServiceWorkerController();
 }