Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1363)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContentsBackgroundThreadClient.java

Issue 1350553005: [Android WebView] Call shouldInterceptRequest on a background thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final version? Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698