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

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

Issue 12620004: [android_webview] Fake onReceivedError callback for intercepted navigations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make findbugs happy Created 7 years, 9 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
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContentsClientCallbackHelper.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index dc8c40ae02dbe789f2a811fc4b7e3adff28bcce4..24116574210740c60d59b72c3ff00e95e523318d 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -142,32 +142,44 @@ public class AwContents {
@Override
public int getCacheMode() {
- return AwContents.this.mSettings.getCacheMode();
+ return mSettings.getCacheMode();
}
@Override
- public InterceptedRequestData shouldInterceptRequest(final String url) {
+ public InterceptedRequestData shouldInterceptRequest(final String url,
+ boolean isMainFrame) {
InterceptedRequestData interceptedRequestData =
- AwContents.this.mContentsClient.shouldInterceptRequest(url);
+ mContentsClient.shouldInterceptRequest(url);
+
if (interceptedRequestData == null) {
mContentsClient.getCallbackHelper().postOnLoadResource(url);
}
+
+ if (isMainFrame && interceptedRequestData != null &&
+ interceptedRequestData.getData() == null) {
+ // In this case the intercepted URLRequest job will simulate an empty response
+ // which doesn't trigger the onReceivedError callback. For WebViewClassic
+ // compatibility we synthesize that callback. http://crbug.com/180950
+ mContentsClient.getCallbackHelper().postOnReceivedError(
+ ErrorCodeConversionHelper.ERROR_UNKNOWN,
+ null /* filled in by the glue layer */, url);
+ }
return interceptedRequestData;
}
@Override
public boolean shouldBlockContentUrls() {
- return !AwContents.this.mSettings.getAllowContentAccess();
+ return !mSettings.getAllowContentAccess();
}
@Override
public boolean shouldBlockFileUrls() {
- return !AwContents.this.mSettings.getAllowFileAccess();
+ return !mSettings.getAllowFileAccess();
}
@Override
public boolean shouldBlockNetworkLoads() {
- return AwContents.this.mSettings.getBlockNetworkLoads();
+ return mSettings.getBlockNetworkLoads();
}
@Override
@@ -207,7 +219,7 @@ public class AwContents {
// The embedder is also not allowed to intercept POST requests because of
// crbug.com/155250.
} else if (!navigationParams.isPost) {
- ignoreNavigation = AwContents.this.mContentsClient.shouldIgnoreNavigation(url);
+ ignoreNavigation = mContentsClient.shouldIgnoreNavigation(url);
}
// The existing contract is that shouldIgnoreNavigation callbacks are delivered before
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContentsClientCallbackHelper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698