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