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

Unified Diff: android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java

Issue 992593003: [Android WebView] Lay the groundwork for a better onReceivedError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test Created 5 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/AwContents.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
index 8413a716660ff86c612dd634543b045ef2e7c1fe..54d1e79fb9efd2dce5648401a12d05416fef82c9 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java
@@ -587,13 +587,43 @@ public class WebViewContentsClientAdapter extends AwContentsClient {
description = mWebViewDelegate.getErrorString(mContext, errorCode);
}
if (TRACE) Log.d(TAG, "onReceivedError=" + failingUrl);
- mWebViewClient.onReceivedError(mWebView, errorCode, description, failingUrl);
+ // TODO(mnaganov): In the next version of glue, this will look as follows:
+ // if (!<next-level-api>) {
+ // mWebViewClient.onReceivedError(mWebView, errorCode, description, failingUrl);
+ // }
+ mWebViewClient.onReceivedError(
+ mWebView, errorCode, description, failingUrl);
} finally {
TraceEvent.end("WebViewContentsClientAdapter.onReceivedError");
}
}
/**
+ * @see ContentViewClient#onReceivedError(
+ * AwContentsClient.AwWebResourceRequest,AwContentsClient.AwWebResourceError)
+ */
+ @Override
+ public void onReceivedError2(AwContentsClient.AwWebResourceRequest request,
+ AwContentsClient.AwWebResourceError error) {
+ try {
+ TraceEvent.begin("WebViewContentsClientAdapter.onReceivedError2");
+ if (error.description == null || error.description.isEmpty()) {
+ // ErrorStrings is @hidden, so we can't do this in AwContents. Normally the net/
+ // layer will set a valid description, but for synthesized callbacks (like in the
+ // case for intercepted requests) AwContents will pass in null.
+ error.description = mWebViewDelegate.getErrorString(mContext, error.errorCode);
Torne 2015/03/09 16:00:36 Is this costly at all? We might want to only do it
mnaganov (inactive) 2015/03/09 16:53:39 It goes into some reflection bullsh*t, so indeed l
+ }
+ if (TRACE) Log.d(TAG, "onReceivedError2=" + request.url);
+ // TODO(mnaganov): In the next version of glue, this will look as follows:
+ // if (<next-level-api>) {
+ // mWebViewClient.onReceivedError(request, error);
+ // }
+ } finally {
+ TraceEvent.end("WebViewContentsClientAdapter.onReceivedError2");
+ }
+ }
+
+ /**
* @see ContentViewClient#onReceivedTitle(String)
*/
@Override
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698