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

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

Issue 2558223002: Move onReceivedError and onReceivedHttpError out of AwContentsIoThreadClientImpl (Closed)
Patch Set: add move assignment Created 4 years 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
Index: android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java
index db658eda4e503e53d82df9faaff89a29f040bcef..bd972fedbc43388b5e6f845152bbbfc693de5699 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java
@@ -7,9 +7,6 @@ package org.chromium.android_webview;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* Delegate for handling callbacks. All methods are called on the IO thread.
*
@@ -35,73 +32,4 @@ public abstract class AwContentsIoThreadClient {
@CalledByNative
public abstract AwContentsBackgroundThreadClient getBackgroundThreadClient();
-
- public abstract void onReceivedError(AwContentsClient.AwWebResourceRequest request,
- AwContentsClient.AwWebResourceError error);
-
- public abstract void onReceivedHttpError(AwContentsClient.AwWebResourceRequest request,
- AwWebResourceResponse response);
-
- // Protected methods ---------------------------------------------------------------------------
-
- @CalledByNative
- protected void onReceivedError(
- // WebResourceRequest
- String url, boolean isMainFrame, boolean hasUserGesture, String method,
- String[] requestHeaderNames, String[] requestHeaderValues,
- // WebResourceError
- int errorCode, String description) {
- AwContentsClient.AwWebResourceRequest request =
- new AwContentsClient.AwWebResourceRequest();
- request.url = url;
- request.isMainFrame = isMainFrame;
- request.hasUserGesture = hasUserGesture;
- request.method = method;
- request.requestHeaders = new HashMap<String, String>(requestHeaderNames.length);
- for (int i = 0; i < requestHeaderNames.length; ++i) {
- request.requestHeaders.put(requestHeaderNames[i], requestHeaderValues[i]);
- }
- AwContentsClient.AwWebResourceError error = new AwContentsClient.AwWebResourceError();
- error.errorCode = errorCode;
- error.description = description;
- onReceivedError(request, error);
- }
-
- @CalledByNative
- protected void onReceivedHttpError(
- // WebResourceRequest
- String url, boolean isMainFrame, boolean hasUserGesture, String method,
- String[] requestHeaderNames, String[] requestHeaderValues,
- // WebResourceResponse
- String mimeType, String encoding, int statusCode, String reasonPhrase,
- String[] responseHeaderNames, String[] responseHeaderValues) {
- AwContentsClient.AwWebResourceRequest request =
- new AwContentsClient.AwWebResourceRequest();
- request.url = url;
- request.isMainFrame = isMainFrame;
- request.hasUserGesture = hasUserGesture;
- request.method = method;
- request.requestHeaders = new HashMap<String, String>(requestHeaderNames.length);
- for (int i = 0; i < requestHeaderNames.length; ++i) {
- request.requestHeaders.put(requestHeaderNames[i], requestHeaderValues[i]);
- }
- Map<String, String> responseHeaders =
- new HashMap<String, String>(responseHeaderNames.length);
- // Note that we receive un-coalesced response header lines, thus we need to combine
- // values for the same header.
- for (int i = 0; i < responseHeaderNames.length; ++i) {
- if (!responseHeaders.containsKey(responseHeaderNames[i])) {
- responseHeaders.put(responseHeaderNames[i], responseHeaderValues[i]);
- } else if (!responseHeaderValues[i].isEmpty()) {
- String currentValue = responseHeaders.get(responseHeaderNames[i]);
- if (!currentValue.isEmpty()) {
- currentValue += ", ";
- }
- responseHeaders.put(responseHeaderNames[i], currentValue + responseHeaderValues[i]);
- }
- }
- AwWebResourceResponse response = new AwWebResourceResponse(
- mimeType, encoding, null, statusCode, reasonPhrase, responseHeaders);
- onReceivedHttpError(request, response);
- }
}

Powered by Google App Engine
This is Rietveld 408576698