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 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ | 5 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ |
6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ | 6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "net/base/request_priority.h" | 15 #include "net/base/request_priority.h" |
16 #include "net/http/http_request_headers.h" | 16 #include "net/http/http_request_headers.h" |
17 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class GrowableIOBuffer; | 20 class GrowableIOBuffer; |
21 class HttpResponseHeaders; | |
21 class UploadDataStream; | 22 class UploadDataStream; |
22 } // namespace net | 23 } // namespace net |
23 | 24 |
24 namespace cronet { | 25 namespace cronet { |
25 | 26 |
26 class URLRequestContextPeer; | 27 class URLRequestContextPeer; |
27 | 28 |
28 // An adapter from the JNI |UrlRequest| object and the Chromium |URLRequest| | 29 // An adapter from the JNI |UrlRequest| object and the Chromium |URLRequest| |
29 // object. | 30 // object. |
30 class URLRequestPeer : public net::URLRequest::Delegate { | 31 class URLRequestPeer : public net::URLRequest::Delegate { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 | 84 |
84 // Returns the value of the content-length response header. | 85 // Returns the value of the content-length response header. |
85 int64 content_length() const { return expected_size_; } | 86 int64 content_length() const { return expected_size_; } |
86 | 87 |
87 // Returns the value of the content-type response header. | 88 // Returns the value of the content-type response header. |
88 std::string content_type() const { return content_type_; } | 89 std::string content_type() const { return content_type_; } |
89 | 90 |
90 // Returns the value of the specified response header. | 91 // Returns the value of the specified response header. |
91 std::string GetHeader(const std::string& name) const; | 92 std::string GetHeader(const std::string& name) const; |
92 | 93 |
94 // Get all response headers, as a HttpResponseHeaders object. | |
95 net::HttpResponseHeaders* response_headers() const; | |
mmenke
2014/08/04 21:39:55
If this isn't inlined, should get called GetRespon
mef
2014/08/04 21:57:53
Done.
| |
96 | |
93 // Returns the overall number of bytes read. | 97 // Returns the overall number of bytes read. |
94 size_t bytes_read() const { return bytes_read_; } | 98 size_t bytes_read() const { return bytes_read_; } |
95 | 99 |
96 // Returns a pointer to the downloaded data. | 100 // Returns a pointer to the downloaded data. |
97 unsigned char* Data() const; | 101 unsigned char* Data() const; |
98 | 102 |
99 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; | 103 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; |
100 | 104 |
101 virtual void OnReadCompleted(net::URLRequest* request, | 105 virtual void OnReadCompleted(net::URLRequest* request, |
102 int bytes_read) OVERRIDE; | 106 int bytes_read) OVERRIDE; |
(...skipping 28 matching lines...) Expand all Loading... | |
131 std::string content_type_; | 135 std::string content_type_; |
132 bool canceled_; | 136 bool canceled_; |
133 int64 expected_size_; | 137 int64 expected_size_; |
134 | 138 |
135 DISALLOW_COPY_AND_ASSIGN(URLRequestPeer); | 139 DISALLOW_COPY_AND_ASSIGN(URLRequestPeer); |
136 }; | 140 }; |
137 | 141 |
138 } // namespace cronet | 142 } // namespace cronet |
139 | 143 |
140 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ | 144 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ |
OLD | NEW |