Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
| 6 | 6 |
| 7 import org.chromium.base.CalledByNative; | 7 import org.chromium.base.CalledByNative; |
| 8 import org.chromium.base.JNINamespace; | 8 import org.chromium.base.JNINamespace; |
| 9 | 9 |
| 10 import java.util.HashMap; | |
| 11 | |
| 10 /** | 12 /** |
| 11 * Delegate for handling callbacks. All methods are called on the IO thread. | 13 * Delegate for handling callbacks. All methods are called on the IO thread. |
| 12 * | 14 * |
| 13 * You should create a separate instance for every WebContents that requires the | 15 * You should create a separate instance for every WebContents that requires the |
| 14 * provided functionality. | 16 * provided functionality. |
| 15 */ | 17 */ |
| 16 @JNINamespace("android_webview") | 18 @JNINamespace("android_webview") |
| 17 public interface AwContentsIoThreadClient { | 19 public abstract class AwContentsIoThreadClient { |
| 18 @CalledByNative | 20 @CalledByNative |
| 19 public int getCacheMode(); | 21 public abstract int getCacheMode(); |
| 20 | 22 |
| 21 @CalledByNative | 23 @CalledByNative |
| 22 public InterceptedRequestData shouldInterceptRequest(String url, boolean isM ainFrame); | 24 public abstract void onDownloadStart(String url, String userAgent, |
| 23 | |
| 24 @CalledByNative | |
| 25 public boolean shouldBlockContentUrls(); | |
| 26 | |
| 27 @CalledByNative | |
| 28 public boolean shouldBlockFileUrls(); | |
| 29 | |
| 30 @CalledByNative | |
| 31 public boolean shouldBlockNetworkLoads(); | |
| 32 | |
| 33 @CalledByNative | |
| 34 public void onDownloadStart(String url, String userAgent, | |
| 35 String contentDisposition, String mimeType, long contentLength); | 25 String contentDisposition, String mimeType, long contentLength); |
| 36 | 26 |
| 37 @CalledByNative | 27 @CalledByNative |
| 38 public void newLoginRequest(String realm, String account, String args); | 28 public abstract void newLoginRequest(String realm, String account, String ar gs); |
| 29 | |
| 30 @CalledByNative | |
| 31 public abstract boolean shouldBlockContentUrls(); | |
| 32 | |
| 33 @CalledByNative | |
| 34 public abstract boolean shouldBlockFileUrls(); | |
| 35 | |
| 36 @CalledByNative | |
| 37 public abstract boolean shouldBlockNetworkLoads(); | |
| 38 | |
| 39 public abstract InterceptedRequestData shouldInterceptRequest( | |
| 40 AwContentsClient.ShouldInterceptRequestParams params); | |
| 41 | |
| 42 // Protected methods ------------------------------------------------------- -------------------- | |
| 43 | |
| 44 @CalledByNative | |
| 45 protected InterceptedRequestData shouldInterceptRequest(String url, boolean isMainFrame, | |
| 46 boolean hasUserGesture, String method, String[] headerNames, String[ ] headerValues) { | |
|
benm (inactive)
2014/05/15 17:43:15
requestHeaders
mkosiba (inactive)
2014/06/19 17:54:14
Done.
| |
| 47 AwContentsClient.ShouldInterceptRequestParams params = | |
| 48 new AwContentsClient.ShouldInterceptRequestParams(); | |
| 49 params.url = url; | |
| 50 params.isMainFrame = isMainFrame; | |
| 51 params.hasUserGesture = hasUserGesture; | |
| 52 params.method = method; | |
| 53 params.headers = new HashMap<String, String>(headerNames.length); | |
| 54 for (int i = 0; i < headerNames.length; ++i) { | |
| 55 params.headers.put(headerNames[i], headerValues[i]); | |
| 56 } | |
| 57 return shouldInterceptRequest(params); | |
| 58 } | |
| 39 } | 59 } |
| OLD | NEW |