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

Side by Side Diff: components/cronet/android/url_request_adapter.cc

Issue 544223003: Add SetSupportsQuic method to explicitly specify server that supports QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync Created 6 years, 3 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
OLDNEW
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 "url_request_adapter.h" 5 #include "url_request_adapter.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return value; 93 return value;
94 } 94 }
95 95
96 net::HttpResponseHeaders* URLRequestAdapter::GetResponseHeaders() const { 96 net::HttpResponseHeaders* URLRequestAdapter::GetResponseHeaders() const {
97 if (url_request_ == NULL) { 97 if (url_request_ == NULL) {
98 return NULL; 98 return NULL;
99 } 99 }
100 return url_request_->response_headers(); 100 return url_request_->response_headers();
101 } 101 }
102 102
103 std::string URLRequestAdapter::GetNegotiatedProtocol() const {
104 if (url_request_ == NULL)
105 return std::string();
106 return url_request_->response_info().npn_negotiated_protocol;
107 }
108
103 void URLRequestAdapter::Start() { 109 void URLRequestAdapter::Start() {
104 context_->GetNetworkTaskRunner()->PostTask( 110 context_->GetNetworkTaskRunner()->PostTask(
105 FROM_HERE, 111 FROM_HERE,
106 base::Bind(&URLRequestAdapter::OnInitiateConnection, 112 base::Bind(&URLRequestAdapter::OnInitiateConnection,
107 base::Unretained(this))); 113 base::Unretained(this)));
108 } 114 }
109 115
110 void URLRequestAdapter::OnAppendChunk(const scoped_ptr<char[]> bytes, 116 void URLRequestAdapter::OnAppendChunk(const scoped_ptr<char[]> bytes,
111 int bytes_len, bool is_last_chunk) { 117 int bytes_len, bool is_last_chunk) {
112 url_request_->AppendChunkToUpload(bytes.get(), bytes_len, is_last_chunk); 118 url_request_->AppendChunkToUpload(bytes.get(), bytes_len, is_last_chunk);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 290
285 delegate_->OnBytesRead(this); 291 delegate_->OnBytesRead(this);
286 delegate_->OnRequestFinished(this); 292 delegate_->OnRequestFinished(this);
287 } 293 }
288 294
289 unsigned char* URLRequestAdapter::Data() const { 295 unsigned char* URLRequestAdapter::Data() const {
290 return reinterpret_cast<unsigned char*>(read_buffer_->StartOfBuffer()); 296 return reinterpret_cast<unsigned char*>(read_buffer_->StartOfBuffer());
291 } 297 }
292 298
293 } // namespace cronet 299 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698