1/* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.webkit; 18 19/** 20 * Base class for clients to capture Service Worker related callbacks, 21 * see {@link ServiceWorkerController} for usage example. 22 */ 23public class ServiceWorkerClient { 24 25 /** 26 * Notify the host application of a resource request and allow the 27 * application to return the data. If the return value is null, the 28 * Service Worker will continue to load the resource as usual. 29 * Otherwise, the return response and data will be used. 30 * NOTE: This method is called on a thread other than the UI thread 31 * so clients should exercise caution when accessing private data 32 * or the view system. 33 * 34 * @param request Object containing the details of the request. 35 * @return A {@link android.webkit.WebResourceResponse} containing the 36 * response information or null if the WebView should load the 37 * resource itself. 38 * @see WebViewClient#shouldInterceptRequest(WebView, WebResourceRequest) 39 */ 40 public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) { 41 return null; 42 } 43} 44 45