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

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

Issue 284123004: [android_webview] Add more params to request intercepting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 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;
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) {
34 this(mimeType, encoding, data);
35
36 assert statusCode < 100 || statusCode >= 600;
agrieve 2014/05/15 14:01:19 Is this backwards?
mkosiba (inactive) 2014/05/15 14:31:50 oh, yeath.. hmm.. I guess tests don't actually run
mnaganov (inactive) 2014/05/15 14:55:26 For me, the test runner usually complains somethin
37 mStatusCode = statusCode;
38 mReasonPhrase = reasonPhrase;
39
40 mHeaderNames = new String[headers.size()];
41 mHeaderValues = new String[headers.size()];
42 int i = 0;
43 for (Map.Entry<String, String> entry : headers.entrySet()) {
44 mHeaderNames[i] = entry.getKey();
45 mHeaderValues[i] = entry.getValue();
46 i++;
47 }
48 }
49
27 @CalledByNative 50 @CalledByNative
28 public String getMimeType() { 51 public String getMimeType() {
29 return mMimeType; 52 return mMimeType;
30 } 53 }
31 54
32 @CalledByNative 55 @CalledByNative
33 public String getCharset() { 56 public String getCharset() {
34 return mCharset; 57 return mCharset;
35 } 58 }
36 59
37 @CalledByNative 60 @CalledByNative
38 public InputStream getData() { 61 public InputStream getData() {
39 return mData; 62 return mData;
40 } 63 }
64
65 @CalledByNative
66 public int getStatusCode() {
67 return mStatusCode;
68 }
69
70 @CalledByNative
71 public String getReasonPhrase() {
72 return mReasonPhrase;
73 }
74
75 @CalledByNative
76 public String[] getHeaderNames() {
77 return mHeaderNames;
78 }
79
80 @CalledByNative
81 public String[] getHeaderValues() {
82 return mHeaderValues;
83 }
41 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698