summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/WebViewClient.java
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-11-11 13:16:44 -0500
committerPatrick Scott <phanna@android.com>2010-11-15 09:19:38 -0500
commitc12544a201667383bc3dfb4bd3ad62d98cacd24f (patch)
tree07cb73580be76718cc11bd98b48cb83a0ab3fbec /core/java/android/webkit/WebViewClient.java
parent83d4a23c280bdcaf6c301651b76ddc6fbf08949c (diff)
Offer a callback to intercept url requests.
The new callback allows applications to return a response for a particular url. Deprecate onLoadResource in favor of the new api. onLoadResource is not currently being used by the new network stack and applications can post a message from shouldInterceptRequest to handle onLoadResource. Bug: 2905943 Change-Id: Icf48ab3110d85d76112b3c3b4a1a8c8a333b82f0
Diffstat (limited to 'core/java/android/webkit/WebViewClient.java')
-rw-r--r--core/java/android/webkit/WebViewClient.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java
index 1f8eeba9016c..db605de6dc77 100644
--- a/core/java/android/webkit/WebViewClient.java
+++ b/core/java/android/webkit/WebViewClient.java
@@ -78,6 +78,26 @@ public class WebViewClient {
}
/**
+ * 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 by the
+ * network thread so clients should exercise caution when accessing private
+ * data.
+ *
+ * @param view The {@link android.webkit.WebView} that is requesting the
+ * resource.
+ * @param url The raw url of the resource.
+ * @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,
+ String url) {
+ return null;
+ }
+
+ /**
* 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