| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "net/base/cache_type.h" | 16 #include "net/base/cache_type.h" |
| 17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 18 #include "net/base/network_delegate_impl.h" | 18 #include "net/base/network_delegate_impl.h" |
| 19 #include "net/base/sdch_manager.h" |
| 19 #include "net/cert/cert_verifier.h" | 20 #include "net/cert/cert_verifier.h" |
| 20 #include "net/cookies/cookie_monster.h" | 21 #include "net/cookies/cookie_monster.h" |
| 21 #include "net/dns/host_resolver.h" | 22 #include "net/dns/host_resolver.h" |
| 22 #include "net/ftp/ftp_network_layer.h" | 23 #include "net/ftp/ftp_network_layer.h" |
| 23 #include "net/http/http_auth_handler_factory.h" | 24 #include "net/http/http_auth_handler_factory.h" |
| 24 #include "net/http/http_cache.h" | 25 #include "net/http/http_cache.h" |
| 25 #include "net/http/http_network_layer.h" | 26 #include "net/http/http_network_layer.h" |
| 26 #include "net/http/http_network_session.h" | 27 #include "net/http/http_network_session.h" |
| 27 #include "net/http/http_server_properties_impl.h" | 28 #include "net/http/http_server_properties_impl.h" |
| 28 #include "net/http/transport_security_persister.h" | 29 #include "net/http/transport_security_persister.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 199 |
| 199 URLRequestContextBuilder::URLRequestContextBuilder() | 200 URLRequestContextBuilder::URLRequestContextBuilder() |
| 200 : data_enabled_(false), | 201 : data_enabled_(false), |
| 201 #if !defined(DISABLE_FILE_SUPPORT) | 202 #if !defined(DISABLE_FILE_SUPPORT) |
| 202 file_enabled_(false), | 203 file_enabled_(false), |
| 203 #endif | 204 #endif |
| 204 #if !defined(DISABLE_FTP_SUPPORT) | 205 #if !defined(DISABLE_FTP_SUPPORT) |
| 205 ftp_enabled_(false), | 206 ftp_enabled_(false), |
| 206 #endif | 207 #endif |
| 207 http_cache_enabled_(true), | 208 http_cache_enabled_(true), |
| 208 throttling_enabled_(false) { | 209 throttling_enabled_(false), |
| 210 sdch_enabled_(false) { |
| 209 } | 211 } |
| 210 | 212 |
| 211 URLRequestContextBuilder::~URLRequestContextBuilder() {} | 213 URLRequestContextBuilder::~URLRequestContextBuilder() {} |
| 212 | 214 |
| 213 void URLRequestContextBuilder::EnableHttpCache(const HttpCacheParams& params) { | 215 void URLRequestContextBuilder::EnableHttpCache(const HttpCacheParams& params) { |
| 214 http_cache_enabled_ = true; | 216 http_cache_enabled_ = true; |
| 215 http_cache_params_ = params; | 217 http_cache_params_ = params; |
| 216 } | 218 } |
| 217 | 219 |
| 218 void URLRequestContextBuilder::DisableHttpCache() { | 220 void URLRequestContextBuilder::DisableHttpCache() { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 storage->set_cookie_store(cookie_store_.get()); | 305 storage->set_cookie_store(cookie_store_.get()); |
| 304 storage->set_channel_id_service(channel_id_service_.Pass()); | 306 storage->set_channel_id_service(channel_id_service_.Pass()); |
| 305 } else { | 307 } else { |
| 306 storage->set_cookie_store(new CookieMonster(NULL, NULL)); | 308 storage->set_cookie_store(new CookieMonster(NULL, NULL)); |
| 307 // TODO(mmenke): This always creates a file thread, even when it ends up | 309 // TODO(mmenke): This always creates a file thread, even when it ends up |
| 308 // not being used. Consider lazily creating the thread. | 310 // not being used. Consider lazily creating the thread. |
| 309 storage->set_channel_id_service(make_scoped_ptr(new ChannelIDService( | 311 storage->set_channel_id_service(make_scoped_ptr(new ChannelIDService( |
| 310 new DefaultChannelIDStore(NULL), context->GetFileTaskRunner()))); | 312 new DefaultChannelIDStore(NULL), context->GetFileTaskRunner()))); |
| 311 } | 313 } |
| 312 | 314 |
| 315 if (sdch_enabled_) { |
| 316 storage->set_sdch_manager( |
| 317 scoped_ptr<net::SdchManager>(new SdchManager()).Pass()); |
| 318 } |
| 319 |
| 313 storage->set_transport_security_state(new net::TransportSecurityState()); | 320 storage->set_transport_security_state(new net::TransportSecurityState()); |
| 314 if (!transport_security_persister_path_.empty()) { | 321 if (!transport_security_persister_path_.empty()) { |
| 315 context->set_transport_security_persister( | 322 context->set_transport_security_persister( |
| 316 make_scoped_ptr<TransportSecurityPersister>( | 323 make_scoped_ptr<TransportSecurityPersister>( |
| 317 new TransportSecurityPersister(context->transport_security_state(), | 324 new TransportSecurityPersister(context->transport_security_state(), |
| 318 transport_security_persister_path_, | 325 transport_security_persister_path_, |
| 319 context->GetFileTaskRunner(), | 326 context->GetFileTaskRunner(), |
| 320 false))); | 327 false))); |
| 321 } | 328 } |
| 322 | 329 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 #endif // !defined(DISABLE_FTP_SUPPORT) | 412 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 406 | 413 |
| 407 storage->set_job_factory(job_factory); | 414 storage->set_job_factory(job_factory); |
| 408 | 415 |
| 409 // TODO(willchan): Support sdch. | 416 // TODO(willchan): Support sdch. |
| 410 | 417 |
| 411 return context; | 418 return context; |
| 412 } | 419 } |
| 413 | 420 |
| 414 } // namespace net | 421 } // namespace net |
| OLD | NEW |