Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "net/url_request/url_request_context_builder.h" | 5 #include "net/url_request/url_request_context_builder.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | |
| 8 | 9 |
| 9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 13 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 14 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 16 #include "net/base/cache_type.h" | 18 #include "net/base/cache_type.h" |
| 17 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 18 #include "net/base/network_delegate_impl.h" | 20 #include "net/base/network_delegate_impl.h" |
| 19 #include "net/base/sdch_manager.h" | 21 #include "net/base/sdch_manager.h" |
| 20 #include "net/cert/cert_verifier.h" | 22 #include "net/cert/cert_verifier.h" |
| 21 #include "net/cookies/cookie_monster.h" | 23 #include "net/cookies/cookie_monster.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 NextProtosWithSpdyAndQuic(spdy_enabled, quic_enabled); | 246 NextProtosWithSpdyAndQuic(spdy_enabled, quic_enabled); |
| 245 http_network_session_params_.enable_quic = quic_enabled; | 247 http_network_session_params_.enable_quic = quic_enabled; |
| 246 } | 248 } |
| 247 | 249 |
| 248 void URLRequestContextBuilder::SetCertVerifier( | 250 void URLRequestContextBuilder::SetCertVerifier( |
| 249 scoped_ptr<CertVerifier> cert_verifier) { | 251 scoped_ptr<CertVerifier> cert_verifier) { |
| 250 cert_verifier_ = cert_verifier.Pass(); | 252 cert_verifier_ = cert_verifier.Pass(); |
| 251 } | 253 } |
| 252 | 254 |
| 253 void URLRequestContextBuilder::SetInterceptors( | 255 void URLRequestContextBuilder::SetInterceptors( |
| 254 ScopedVector<URLRequestInterceptor> url_request_interceptors) { | 256 std::vector<scoped_ptr<URLRequestInterceptor>> url_request_interceptors) { |
| 255 url_request_interceptors_ = url_request_interceptors.Pass(); | 257 url_request_interceptors_ = std::move(url_request_interceptors); |
| 256 } | 258 } |
| 257 | 259 |
| 258 void URLRequestContextBuilder::SetCookieAndChannelIdStores( | 260 void URLRequestContextBuilder::SetCookieAndChannelIdStores( |
| 259 const scoped_refptr<CookieStore>& cookie_store, | 261 const scoped_refptr<CookieStore>& cookie_store, |
| 260 scoped_ptr<ChannelIDService> channel_id_service) { | 262 scoped_ptr<ChannelIDService> channel_id_service) { |
| 261 DCHECK(cookie_store); | 263 DCHECK(cookie_store); |
| 262 cookie_store_ = cookie_store; | 264 cookie_store_ = cookie_store; |
| 263 channel_id_service_ = channel_id_service.Pass(); | 265 channel_id_service_ = channel_id_service.Pass(); |
| 264 } | 266 } |
| 265 | 267 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 job_factory->SetProtocolHandler( | 453 job_factory->SetProtocolHandler( |
| 452 "ftp", make_scoped_ptr( | 454 "ftp", make_scoped_ptr( |
| 453 new FtpProtocolHandler(ftp_transaction_factory_.get()))); | 455 new FtpProtocolHandler(ftp_transaction_factory_.get()))); |
| 454 } | 456 } |
| 455 #endif // !defined(DISABLE_FTP_SUPPORT) | 457 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 456 | 458 |
| 457 scoped_ptr<net::URLRequestJobFactory> top_job_factory(job_factory); | 459 scoped_ptr<net::URLRequestJobFactory> top_job_factory(job_factory); |
| 458 if (!url_request_interceptors_.empty()) { | 460 if (!url_request_interceptors_.empty()) { |
| 459 // Set up interceptors in the reverse order. | 461 // Set up interceptors in the reverse order. |
| 460 | 462 |
| 461 for (ScopedVector<net::URLRequestInterceptor>::reverse_iterator i = | 463 for (std::vector<scoped_ptr<net::URLRequestInterceptor>>::reverse_iterator |
|
Ryan Sleevi
2015/12/09 18:20:22
for (auto i = url_request_interceptors_.rbegin();
| |
| 462 url_request_interceptors_.rbegin(); | 464 i = url_request_interceptors_.rbegin(); |
| 463 i != url_request_interceptors_.rend(); ++i) { | 465 i != url_request_interceptors_.rend(); ++i) { |
| 464 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( | 466 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( |
| 465 top_job_factory.Pass(), make_scoped_ptr(*i))); | 467 std::move(top_job_factory), std::move(*i))); |
| 466 } | 468 } |
| 467 url_request_interceptors_.weak_clear(); | 469 url_request_interceptors_.clear(); |
| 468 } | 470 } |
| 469 storage->set_job_factory(top_job_factory.Pass()); | 471 storage->set_job_factory(std::move(top_job_factory)); |
| 470 // TODO(willchan): Support sdch. | 472 // TODO(willchan): Support sdch. |
| 471 | 473 |
| 472 return context.Pass(); | 474 return std::move(context); |
| 473 } | 475 } |
| 474 | 476 |
| 475 } // namespace net | 477 } // namespace net |
| OLD | NEW |