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 #include "components/cronet/android/url_request_adapter.h" | 5 #include "components/cronet/android/url_request_adapter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 net::HttpResponseHeaders* URLRequestAdapter::GetResponseHeaders() const { | 103 net::HttpResponseHeaders* URLRequestAdapter::GetResponseHeaders() const { |
104 if (url_request_ == NULL) { | 104 if (url_request_ == NULL) { |
105 return NULL; | 105 return NULL; |
106 } | 106 } |
107 return url_request_->response_headers(); | 107 return url_request_->response_headers(); |
108 } | 108 } |
109 | 109 |
110 std::string URLRequestAdapter::GetNegotiatedProtocol() const { | 110 std::string URLRequestAdapter::GetNegotiatedProtocol() const { |
111 if (url_request_ == NULL) | 111 if (url_request_ == NULL) |
112 return std::string(); | 112 return std::string(); |
113 return url_request_->response_info().npn_negotiated_protocol; | 113 return url_request_->response_info().alpn_negotiated_protocol; |
114 } | 114 } |
115 | 115 |
116 bool URLRequestAdapter::GetWasCached() const { | 116 bool URLRequestAdapter::GetWasCached() const { |
117 if (url_request_ == NULL) | 117 if (url_request_ == NULL) |
118 return false; | 118 return false; |
119 return url_request_->response_info().was_cached; | 119 return url_request_->response_info().was_cached; |
120 } | 120 } |
121 | 121 |
122 void URLRequestAdapter::Start() { | 122 void URLRequestAdapter::Start() { |
123 context_->PostTaskToNetworkThread( | 123 context_->PostTaskToNetworkThread( |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 unsigned char* URLRequestAdapter::Data() const { | 324 unsigned char* URLRequestAdapter::Data() const { |
325 DCHECK(OnNetworkThread()); | 325 DCHECK(OnNetworkThread()); |
326 return reinterpret_cast<unsigned char*>(read_buffer_->data()); | 326 return reinterpret_cast<unsigned char*>(read_buffer_->data()); |
327 } | 327 } |
328 | 328 |
329 bool URLRequestAdapter::OnNetworkThread() const { | 329 bool URLRequestAdapter::OnNetworkThread() const { |
330 return context_->GetNetworkTaskRunner()->BelongsToCurrentThread(); | 330 return context_->GetNetworkTaskRunner()->BelongsToCurrentThread(); |
331 } | 331 } |
332 | 332 |
333 } // namespace cronet | 333 } // namespace cronet |
OLD | NEW |