Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f2f3606 authored by Tim Volodine's avatar Tim Volodine Committed by Android (Google) Code Review
Browse files

Merge "Add Service Worker settings and callback support in WebView."

parents 444280d2 28c83564
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -44092,6 +44092,30 @@ package android.webkit {
    method public abstract android.view.View getFullScreenView(int, android.content.Context);
  }
  public class ServiceWorkerClient {
    ctor public ServiceWorkerClient();
    method public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebResourceRequest);
  }
  public abstract class ServiceWorkerController {
    ctor public ServiceWorkerController();
    method public static android.webkit.ServiceWorkerController getInstance();
    method public abstract android.webkit.ServiceWorkerWebSettings getServiceWorkerWebSettings();
    method public abstract void setServiceWorkerClient(android.webkit.ServiceWorkerClient);
  }
  public abstract class ServiceWorkerWebSettings {
    ctor public ServiceWorkerWebSettings();
    method public abstract boolean getAllowContentAccess();
    method public abstract boolean getAllowFileAccess();
    method public abstract boolean getBlockNetworkLoads();
    method public abstract int getCacheMode();
    method public abstract void setAllowContentAccess(boolean);
    method public abstract void setAllowFileAccess(boolean);
    method public abstract void setBlockNetworkLoads(boolean);
    method public abstract void setCacheMode(int);
  }
  public class SslErrorHandler extends android.os.Handler {
    method public void cancel();
    method public void proceed();
+25 −0
Original line number Diff line number Diff line
@@ -46576,6 +46576,30 @@ package android.webkit {
    method public abstract android.view.View getFullScreenView(int, android.content.Context);
  }
  public class ServiceWorkerClient {
    ctor public ServiceWorkerClient();
    method public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebResourceRequest);
  }
  public abstract class ServiceWorkerController {
    ctor public ServiceWorkerController();
    method public static android.webkit.ServiceWorkerController getInstance();
    method public abstract android.webkit.ServiceWorkerWebSettings getServiceWorkerWebSettings();
    method public abstract void setServiceWorkerClient(android.webkit.ServiceWorkerClient);
  }
  public abstract class ServiceWorkerWebSettings {
    ctor public ServiceWorkerWebSettings();
    method public abstract boolean getAllowContentAccess();
    method public abstract boolean getAllowFileAccess();
    method public abstract boolean getBlockNetworkLoads();
    method public abstract int getCacheMode();
    method public abstract void setAllowContentAccess(boolean);
    method public abstract void setAllowFileAccess(boolean);
    method public abstract void setBlockNetworkLoads(boolean);
    method public abstract void setCacheMode(int);
  }
  public class SslErrorHandler extends android.os.Handler {
    ctor public SslErrorHandler();
    method public void cancel();
@@ -47215,6 +47239,7 @@ package android.webkit {
    method public abstract android.webkit.WebViewProvider createWebView(android.webkit.WebView, android.webkit.WebView.PrivateAccess);
    method public abstract android.webkit.CookieManager getCookieManager();
    method public abstract android.webkit.GeolocationPermissions getGeolocationPermissions();
    method public abstract android.webkit.ServiceWorkerController getServiceWorkerController();
    method public abstract android.webkit.WebViewFactoryProvider.Statics getStatics();
    method public abstract android.webkit.TokenBindingService getTokenBindingService();
    method public abstract android.webkit.WebIconDatabase getWebIconDatabase();
+24 −0
Original line number Diff line number Diff line
@@ -44108,6 +44108,30 @@ package android.webkit {
    method public abstract android.view.View getFullScreenView(int, android.content.Context);
  }
  public class ServiceWorkerClient {
    ctor public ServiceWorkerClient();
    method public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebResourceRequest);
  }
  public abstract class ServiceWorkerController {
    ctor public ServiceWorkerController();
    method public static android.webkit.ServiceWorkerController getInstance();
    method public abstract android.webkit.ServiceWorkerWebSettings getServiceWorkerWebSettings();
    method public abstract void setServiceWorkerClient(android.webkit.ServiceWorkerClient);
  }
  public abstract class ServiceWorkerWebSettings {
    ctor public ServiceWorkerWebSettings();
    method public abstract boolean getAllowContentAccess();
    method public abstract boolean getAllowFileAccess();
    method public abstract boolean getBlockNetworkLoads();
    method public abstract int getCacheMode();
    method public abstract void setAllowContentAccess(boolean);
    method public abstract void setAllowFileAccess(boolean);
    method public abstract void setBlockNetworkLoads(boolean);
    method public abstract void setCacheMode(int);
  }
  public class SslErrorHandler extends android.os.Handler {
    method public void cancel();
    method public void proceed();
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.webkit;


public class ServiceWorkerClient {

    /**
     * Notify the host application of a resource request and allow the
     * application to return the data. If the return value is null, the
     * Service Worker will continue to load the resource as usual.
     * Otherwise, the return response and data will be used.
     * NOTE: This method is called on a thread other than the UI thread
     * so clients should exercise caution when accessing private data
     * or the view system.
     *
     * @param request Object containing the details of the request.
     * @return A {@link android.webkit.WebResourceResponse} containing the
     *         response information or null if the WebView should load the
     *         resource itself.
     * @see {@link WebViewClient#shouldInterceptRequest()}
     */
    public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) {
        return null;
    }
}
+52 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.webkit;

import android.annotation.NonNull;
import android.annotation.Nullable;

/**
 * Manages Service Workers used by WebView.
 */
public abstract class ServiceWorkerController {

    /**
     * Returns the default ServiceWorkerController instance. At present there is
     * only one ServiceWorkerController instance for all WebView instances,
     * however this restriction may be relaxed in the future.
     *
     * @return The default ServiceWorkerController instance.
     */
     @NonNull
     public static ServiceWorkerController getInstance() {
         return WebViewFactory.getProvider().getServiceWorkerController();
     }

    /**
     * Gets the settings for all service workers.
     *
     * @return The current ServiceWorkerWebSettings
     */
    @NonNull
    public abstract ServiceWorkerWebSettings getServiceWorkerWebSettings();

    /**
     * Sets the client to capture service worker related callbacks.
     */
    public abstract void setServiceWorkerClient(@Nullable ServiceWorkerClient client);
}
Loading