| 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 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "net/http/http_server_properties_impl.h" | 27 #include "net/http/http_server_properties_impl.h" |
| 28 #include "net/http/transport_security_persister.h" | 28 #include "net/http/transport_security_persister.h" |
| 29 #include "net/http/transport_security_state.h" | 29 #include "net/http/transport_security_state.h" |
| 30 #include "net/ssl/channel_id_service.h" | 30 #include "net/ssl/channel_id_service.h" |
| 31 #include "net/ssl/default_channel_id_store.h" | 31 #include "net/ssl/default_channel_id_store.h" |
| 32 #include "net/ssl/ssl_config_service_defaults.h" | 32 #include "net/ssl/ssl_config_service_defaults.h" |
| 33 #include "net/url_request/data_protocol_handler.h" | 33 #include "net/url_request/data_protocol_handler.h" |
| 34 #include "net/url_request/static_http_user_agent_settings.h" | 34 #include "net/url_request/static_http_user_agent_settings.h" |
| 35 #include "net/url_request/url_request_context.h" | 35 #include "net/url_request/url_request_context.h" |
| 36 #include "net/url_request/url_request_context_storage.h" | 36 #include "net/url_request/url_request_context_storage.h" |
| 37 #include "net/url_request/url_request_intercepting_job_factory.h" |
| 38 #include "net/url_request/url_request_interceptor.h" |
| 37 #include "net/url_request/url_request_job_factory_impl.h" | 39 #include "net/url_request/url_request_job_factory_impl.h" |
| 38 #include "net/url_request/url_request_throttler_manager.h" | 40 #include "net/url_request/url_request_throttler_manager.h" |
| 39 | 41 |
| 40 #if !defined(DISABLE_FILE_SUPPORT) | 42 #if !defined(DISABLE_FILE_SUPPORT) |
| 41 #include "net/url_request/file_protocol_handler.h" | 43 #include "net/url_request/file_protocol_handler.h" |
| 42 #endif | 44 #endif |
| 43 | 45 |
| 44 #if !defined(DISABLE_FTP_SUPPORT) | 46 #if !defined(DISABLE_FTP_SUPPORT) |
| 45 #include "net/url_request/ftp_protocol_handler.h" | 47 #include "net/url_request/ftp_protocol_handler.h" |
| 46 #endif | 48 #endif |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 http_cache_params_ = HttpCacheParams(); | 222 http_cache_params_ = HttpCacheParams(); |
| 221 } | 223 } |
| 222 | 224 |
| 223 void URLRequestContextBuilder::SetSpdyAndQuicEnabled(bool spdy_enabled, | 225 void URLRequestContextBuilder::SetSpdyAndQuicEnabled(bool spdy_enabled, |
| 224 bool quic_enabled) { | 226 bool quic_enabled) { |
| 225 http_network_session_params_.next_protos = | 227 http_network_session_params_.next_protos = |
| 226 NextProtosWithSpdyAndQuic(spdy_enabled, quic_enabled); | 228 NextProtosWithSpdyAndQuic(spdy_enabled, quic_enabled); |
| 227 http_network_session_params_.enable_quic = quic_enabled; | 229 http_network_session_params_.enable_quic = quic_enabled; |
| 228 } | 230 } |
| 229 | 231 |
| 232 void URLRequestContextBuilder::SetInterceptors( |
| 233 ScopedVector<URLRequestInterceptor> url_request_interceptors) { |
| 234 url_request_interceptors_ = url_request_interceptors.Pass(); |
| 235 } |
| 236 |
| 230 void URLRequestContextBuilder::SetCookieAndChannelIdStores( | 237 void URLRequestContextBuilder::SetCookieAndChannelIdStores( |
| 231 const scoped_refptr<CookieStore>& cookie_store, | 238 const scoped_refptr<CookieStore>& cookie_store, |
| 232 scoped_ptr<ChannelIDService> channel_id_service) { | 239 scoped_ptr<ChannelIDService> channel_id_service) { |
| 233 DCHECK(cookie_store); | 240 DCHECK(cookie_store); |
| 234 cookie_store_ = cookie_store; | 241 cookie_store_ = cookie_store; |
| 235 channel_id_service_ = channel_id_service.Pass(); | 242 channel_id_service_ = channel_id_service.Pass(); |
| 236 } | 243 } |
| 237 | 244 |
| 238 void URLRequestContextBuilder::SetFileTaskRunner( | 245 void URLRequestContextBuilder::SetFileTaskRunner( |
| 239 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { | 246 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 404 |
| 398 #if !defined(DISABLE_FTP_SUPPORT) | 405 #if !defined(DISABLE_FTP_SUPPORT) |
| 399 if (ftp_enabled_) { | 406 if (ftp_enabled_) { |
| 400 ftp_transaction_factory_.reset( | 407 ftp_transaction_factory_.reset( |
| 401 new FtpNetworkLayer(context->host_resolver())); | 408 new FtpNetworkLayer(context->host_resolver())); |
| 402 job_factory->SetProtocolHandler("ftp", | 409 job_factory->SetProtocolHandler("ftp", |
| 403 new FtpProtocolHandler(ftp_transaction_factory_.get())); | 410 new FtpProtocolHandler(ftp_transaction_factory_.get())); |
| 404 } | 411 } |
| 405 #endif // !defined(DISABLE_FTP_SUPPORT) | 412 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 406 | 413 |
| 407 storage->set_job_factory(job_factory); | 414 scoped_ptr<net::URLRequestJobFactory> top_job_factory(job_factory); |
| 415 if (!url_request_interceptors_.empty()) { |
| 416 // Set up interceptors in the reverse order. |
| 408 | 417 |
| 418 for (ScopedVector<net::URLRequestInterceptor>::reverse_iterator i = |
| 419 url_request_interceptors_.rbegin(); |
| 420 i != url_request_interceptors_.rend(); ++i) { |
| 421 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( |
| 422 top_job_factory.Pass(), make_scoped_ptr(*i))); |
| 423 } |
| 424 url_request_interceptors_.weak_clear(); |
| 425 } |
| 426 storage->set_job_factory(top_job_factory.release()); |
| 409 // TODO(willchan): Support sdch. | 427 // TODO(willchan): Support sdch. |
| 410 | 428 |
| 411 return context; | 429 return context; |
| 412 } | 430 } |
| 413 | 431 |
| 414 } // namespace net | 432 } // namespace net |
| OLD | NEW |