OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |