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 "mojo/services/network/url_loader_impl.h" | 5 #include "mojo/services/network/url_loader_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 SendError(net::ERR_UNEXPECTED, callback); | 170 SendError(net::ERR_UNEXPECTED, callback); |
171 return; | 171 return; |
172 } | 172 } |
173 | 173 |
174 if (!request) { | 174 if (!request) { |
175 SendError(net::ERR_INVALID_ARGUMENT, callback); | 175 SendError(net::ERR_INVALID_ARGUMENT, callback); |
176 return; | 176 return; |
177 } | 177 } |
178 | 178 |
179 url_request_ = context_->url_request_context()->CreateRequest( | 179 url_request_ = context_->url_request_context()->CreateRequest( |
180 GURL(request->url), net::DEFAULT_PRIORITY, this); | 180 GURL(request->url.get()), net::DEFAULT_PRIORITY, this); |
181 url_request_->set_method(request->method); | 181 url_request_->set_method(request->method); |
182 // TODO(jam): need to specify this policy. | 182 // TODO(jam): need to specify this policy. |
183 url_request_->set_referrer_policy( | 183 url_request_->set_referrer_policy( |
184 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE); | 184 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE); |
185 if (request->headers) { | 185 if (request->headers) { |
186 net::HttpRequestHeaders headers; | 186 net::HttpRequestHeaders headers; |
187 for (size_t i = 0; i < request->headers.size(); ++i) { | 187 for (size_t i = 0; i < request->headers.size(); ++i) { |
188 base::StringPiece header = | 188 base::StringPiece header = |
189 request->headers[i]->name.To<base::StringPiece>(); | 189 request->headers[i]->name.To<base::StringPiece>(); |
190 base::StringPiece value = | 190 base::StringPiece value = |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 void URLLoaderImpl::ListenForPeerClosed() { | 418 void URLLoaderImpl::ListenForPeerClosed() { |
419 handle_watcher_.Start(response_body_stream_.get(), | 419 handle_watcher_.Start(response_body_stream_.get(), |
420 MOJO_HANDLE_SIGNAL_PEER_CLOSED, | 420 MOJO_HANDLE_SIGNAL_PEER_CLOSED, |
421 MOJO_DEADLINE_INDEFINITE, | 421 MOJO_DEADLINE_INDEFINITE, |
422 base::Bind(&URLLoaderImpl::OnResponseBodyStreamClosed, | 422 base::Bind(&URLLoaderImpl::OnResponseBodyStreamClosed, |
423 base::Unretained(this))); | 423 base::Unretained(this))); |
424 } | 424 } |
425 | 425 |
426 } // namespace mojo | 426 } // namespace mojo |
OLD | NEW |