OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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; |
11 import java.util.Map; | |
11 | 12 |
12 /** | 13 /** |
13 * The response information that is to be returned for a particular resource fet ch. | 14 * The response information that is to be returned for a particular resource fet ch. |
14 */ | 15 */ |
15 @JNINamespace("android_webview") | 16 @JNINamespace("android_webview") |
16 public class InterceptedRequestData { | 17 public class InterceptedRequestData { |
17 private String mMimeType; | 18 private String mMimeType; |
18 private String mCharset; | 19 private String mCharset; |
19 private InputStream mData; | 20 private InputStream mData; |
21 private int mStatusCode; | |
22 private String mReasonPhrase; | |
23 private String[] mHeaderNames; | |
benm (inactive)
2014/05/15 17:43:15
mResonseHeaders/mResponseValues
mkosiba (inactive)
2014/06/19 17:54:14
Done.
| |
24 private String[] mHeaderValues; | |
20 | 25 |
21 public InterceptedRequestData(String mimeType, String encoding, InputStream data) { | 26 public InterceptedRequestData(String mimeType, String encoding, InputStream data) { |
22 mMimeType = mimeType; | 27 mMimeType = mimeType; |
23 mCharset = encoding; | 28 mCharset = encoding; |
24 mData = data; | 29 mData = data; |
25 } | 30 } |
26 | 31 |
32 public InterceptedRequestData(String mimeType, String encoding, InputStream data, | |
33 int statusCode, String reasonPhrase, Map<String, String> headers) { | |
benm (inactive)
2014/05/15 17:43:15
call it responseHeaders
mkosiba (inactive)
2014/06/19 17:54:14
Done.
| |
34 this(mimeType, encoding, data); | |
35 | |
36 mStatusCode = statusCode; | |
37 mReasonPhrase = reasonPhrase; | |
38 | |
39 mHeaderNames = new String[headers.size()]; | |
40 mHeaderValues = new String[headers.size()]; | |
41 int i = 0; | |
42 for (Map.Entry<String, String> entry : headers.entrySet()) { | |
43 mHeaderNames[i] = entry.getKey(); | |
44 mHeaderValues[i] = entry.getValue(); | |
45 i++; | |
46 } | |
47 } | |
48 | |
27 @CalledByNative | 49 @CalledByNative |
28 public String getMimeType() { | 50 public String getMimeType() { |
29 return mMimeType; | 51 return mMimeType; |
30 } | 52 } |
31 | 53 |
32 @CalledByNative | 54 @CalledByNative |
33 public String getCharset() { | 55 public String getCharset() { |
34 return mCharset; | 56 return mCharset; |
35 } | 57 } |
36 | 58 |
37 @CalledByNative | 59 @CalledByNative |
38 public InputStream getData() { | 60 public InputStream getData() { |
39 return mData; | 61 return mData; |
40 } | 62 } |
63 | |
64 @CalledByNative | |
65 public int getStatusCode() { | |
66 return mStatusCode; | |
67 } | |
68 | |
69 @CalledByNative | |
70 public String getReasonPhrase() { | |
71 return mReasonPhrase; | |
72 } | |
73 | |
74 @CalledByNative | |
75 public String[] getHeaderNames() { | |
76 return mHeaderNames; | |
77 } | |
78 | |
79 @CalledByNative | |
80 public String[] getHeaderValues() { | |
81 return mHeaderValues; | |
82 } | |
41 } | 83 } |
OLD | NEW |