summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/WebViewClient.java
diff options
context:
space:
mode:
authorMarcin Kosiba <mkosiba@google.com>2014-07-15 17:33:47 +0100
committerMarcin Kosiba <mkosiba@google.com>2014-07-15 21:31:44 -0700
commitd72e7ba1c04b2f7b128c5710607a72867b73bf1c (patch)
tree0c904ff6fa5e988d6ca5d6c44213e58b7236fecc /core/java/android/webkit/WebViewClient.java
parent795903e83ddca05445607074fa7fa6369e37dd6d (diff)
Add more params to WebViewClient.shouldInterceptRequest.
This changes shouldInterceptRequest to take an object containing the following new parameters: isMainFrame, hasUserGesture, method, headers. This also lets the embedder specify the following additional properties of the response: status code, response phrase, headers. BUG: 7589347 Change-Id: Id922c5e7023eb067db871e6f782f599492a2428f
Diffstat (limited to 'core/java/android/webkit/WebViewClient.java')
-rw-r--r--core/java/android/webkit/WebViewClient.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java
index 62b80c4a516b..d52dd60e00f0 100644
--- a/core/java/android/webkit/WebViewClient.java
+++ b/core/java/android/webkit/WebViewClient.java
@@ -96,13 +96,36 @@ public class WebViewClient {
* @return A {@link android.webkit.WebResourceResponse} containing the
* response information or null if the WebView should load the
* resource itself.
+ * @deprecated Use {@link #shouldInterceptRequest(WebView, WebResourceRequest)
+ * shouldInterceptRequest(WebView, WebResourceRequest)} instead.
*/
+ @Deprecated
public WebResourceResponse shouldInterceptRequest(WebView view,
String url) {
return null;
}
/**
+ * Notify the host application of a resource request and allow the
+ * application to return the data. If the return value is null, the WebView
+ * 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 view The {@link android.webkit.WebView} that is requesting the
+ * resource.
+ * @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.
+ */
+ public WebResourceResponse shouldInterceptRequest(WebView view,
+ WebResourceRequest request) {
+ return shouldInterceptRequest(view, request.getUrl().toString());
+ }
+
+ /**
* Notify the host application that there have been an excessive number of
* HTTP redirects. As the host application if it would like to continue
* trying to load the resource. The default behavior is to send the cancel