Chromium Code Reviews| Index: android_webview/java/src/org/chromium/android_webview/AwContentsBackgroundThreadClient.java |
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsBackgroundThreadClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsBackgroundThreadClient.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b410ead4d6de6f16b6aa2863fe12bc8df0c4a5f1 |
| --- /dev/null |
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContentsBackgroundThreadClient.java |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2015 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.android_webview; |
| + |
| +import org.chromium.base.annotations.CalledByNative; |
| +import org.chromium.base.annotations.JNINamespace; |
| + |
| +import java.util.HashMap; |
| + |
| +/** |
| + * Delegate for handling callbacks. All methods are called on the background thread. |
| + * "Background" means something that isn't UI or IO. |
| + */ |
| +@JNINamespace("android_webview") |
| +public abstract class AwContentsBackgroundThreadClient { |
| + |
| + public abstract AwWebResourceResponse shouldInterceptRequest( |
| + AwContentsClient.AwWebResourceRequest request); |
| + |
| + // Protected methods --------------------------------------------------------------------------- |
| + |
| + @CalledByNative |
| + protected AwWebResourceResponse shouldInterceptRequest(String url, boolean isMainFrame, |
|
boliu
2015/09/28 23:26:28
private?
And style nit that overloading these two
mnaganov (inactive)
2015/09/29 00:14:06
This is how it was in AwContentsIoThreadClient. Bu
|
| + boolean hasUserGesture, String method, String[] requestHeaderNames, |
| + String[] requestHeaderValues) { |
| + AwContentsClient.AwWebResourceRequest request = |
| + new AwContentsClient.AwWebResourceRequest(); |
| + request.url = url; |
| + request.isMainFrame = isMainFrame; |
| + request.hasUserGesture = hasUserGesture; |
| + request.method = method; |
| + request.requestHeaders = new HashMap<String, String>(requestHeaderNames.length); |
| + for (int i = 0; i < requestHeaderNames.length; ++i) { |
| + request.requestHeaders.put(requestHeaderNames[i], requestHeaderValues[i]); |
| + } |
| + return shouldInterceptRequest(request); |
| + } |
| +} |