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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwWebResourceResponse.java

Issue 392113002: [android_webview] Support null AwWebResourceResponse headers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use equals instead of == Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import org.chromium.base.CalledByNative; 7 import org.chromium.base.CalledByNative;
8 import org.chromium.base.JNINamespace; 8 import org.chromium.base.JNINamespace;
9 9
10 import java.io.InputStream; 10 import java.io.InputStream;
(...skipping 18 matching lines...) Expand all
29 mData = data; 29 mData = data;
30 } 30 }
31 31
32 public AwWebResourceResponse(String mimeType, String encoding, InputStream d ata, 32 public AwWebResourceResponse(String mimeType, String encoding, InputStream d ata,
33 int statusCode, String reasonPhrase, Map<String, String> responseHea ders) { 33 int statusCode, String reasonPhrase, Map<String, String> responseHea ders) {
34 this(mimeType, encoding, data); 34 this(mimeType, encoding, data);
35 35
36 mStatusCode = statusCode; 36 mStatusCode = statusCode;
37 mReasonPhrase = reasonPhrase; 37 mReasonPhrase = reasonPhrase;
38 38
39 mResponseHeaderNames = new String[responseHeaders.size()]; 39 if (responseHeaders != null) {
40 mResponseHeaderValues = new String[responseHeaders.size()]; 40 mResponseHeaderNames = new String[responseHeaders.size()];
41 int i = 0; 41 mResponseHeaderValues = new String[responseHeaders.size()];
42 for (Map.Entry<String, String> entry : responseHeaders.entrySet()) { 42 int i = 0;
43 mResponseHeaderNames[i] = entry.getKey(); 43 for (Map.Entry<String, String> entry : responseHeaders.entrySet()) {
44 mResponseHeaderValues[i] = entry.getValue(); 44 mResponseHeaderNames[i] = entry.getKey();
45 i++; 45 mResponseHeaderValues[i] = entry.getValue();
46 i++;
47 }
46 } 48 }
47 } 49 }
48 50
49 @CalledByNative 51 @CalledByNative
50 public String getMimeType() { 52 public String getMimeType() {
51 return mMimeType; 53 return mMimeType;
52 } 54 }
53 55
54 @CalledByNative 56 @CalledByNative
55 public String getCharset() { 57 public String getCharset() {
(...skipping 18 matching lines...) Expand all
74 @CalledByNative 76 @CalledByNative
75 public String[] getResponseHeaderNames() { 77 public String[] getResponseHeaderNames() {
76 return mResponseHeaderNames; 78 return mResponseHeaderNames;
77 } 79 }
78 80
79 @CalledByNative 81 @CalledByNative
80 public String[] getResponseHeaderValues() { 82 public String[] getResponseHeaderValues() {
81 return mResponseHeaderValues; 83 return mResponseHeaderValues;
82 } 84 }
83 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698