| 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/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "net/base/cert_verifier.h" | 13 #include "net/base/cert_verifier.h" |
| 14 #include "net/base/host_resolver.h" | 14 #include "net/base/host_resolver.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/base/network_delegate.h" | 16 #include "net/base/network_delegate.h" |
| 17 #include "net/base/ssl_config_service_defaults.h" | 17 #include "net/base/ssl_config_service_defaults.h" |
| 18 #include "net/base/transport_security_state.h" | 18 #include "net/base/transport_security_state.h" |
| 19 #include "net/cookies/cookie_monster.h" | 19 #include "net/cookies/cookie_monster.h" |
| 20 #include "net/ftp/ftp_network_layer.h" | 20 #include "net/ftp/ftp_network_layer.h" |
| 21 #include "net/http/http_auth_handler_factory.h" | 21 #include "net/http/http_auth_handler_factory.h" |
| 22 #include "net/http/http_cache.h" | 22 #include "net/http/http_cache.h" |
| 23 #include "net/http/http_network_layer.h" | 23 #include "net/http/http_network_layer.h" |
| 24 #include "net/http/http_network_session.h" | 24 #include "net/http/http_network_session.h" |
| 25 #include "net/http/http_server_properties_impl.h" | 25 #include "net/http/http_server_properties_impl.h" |
| 26 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
| 27 #include "net/url_request/url_request_context.h" | 27 #include "net/url_request/url_request_context.h" |
| 28 #include "net/url_request/url_request_context_storage.h" | 28 #include "net/url_request/url_request_context_storage.h" |
| 29 #include "net/url_request/url_request_throttler_manager.h" |
| 29 | 30 |
| 30 namespace net { | 31 namespace net { |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 class BasicNetworkDelegate : public NetworkDelegate { | 35 class BasicNetworkDelegate : public NetworkDelegate { |
| 35 public: | 36 public: |
| 36 BasicNetworkDelegate() {} | 37 BasicNetworkDelegate() {} |
| 37 virtual ~BasicNetworkDelegate() {} | 38 virtual ~BasicNetworkDelegate() {} |
| 38 | 39 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 proxy_config_service, | 211 proxy_config_service, |
| 211 4, // TODO(willchan): Find a better constant somewhere. | 212 4, // TODO(willchan): Find a better constant somewhere. |
| 212 context->net_log())); | 213 context->net_log())); |
| 213 storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); | 214 storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); |
| 214 storage->set_http_auth_handler_factory( | 215 storage->set_http_auth_handler_factory( |
| 215 net::HttpAuthHandlerRegistryFactory::CreateDefault(host_resolver)); | 216 net::HttpAuthHandlerRegistryFactory::CreateDefault(host_resolver)); |
| 216 storage->set_cookie_store(new CookieMonster(NULL, NULL)); | 217 storage->set_cookie_store(new CookieMonster(NULL, NULL)); |
| 217 storage->set_transport_security_state(new net::TransportSecurityState("")); | 218 storage->set_transport_security_state(new net::TransportSecurityState("")); |
| 218 storage->set_http_server_properties(new net::HttpServerPropertiesImpl); | 219 storage->set_http_server_properties(new net::HttpServerPropertiesImpl); |
| 219 storage->set_cert_verifier(CertVerifier::CreateDefault()); | 220 storage->set_cert_verifier(CertVerifier::CreateDefault()); |
| 221 storage->set_throttler_manager(new URLRequestThrottlerManager()); |
| 220 | 222 |
| 221 HttpTransactionFactory* http_transaction_factory = NULL; | 223 HttpTransactionFactory* http_transaction_factory = NULL; |
| 222 if (http_cache_enabled_) { | 224 if (http_cache_enabled_) { |
| 223 HttpCache::BackendFactory* http_cache_backend = NULL; | 225 HttpCache::BackendFactory* http_cache_backend = NULL; |
| 224 if (http_cache_params_.type == HttpCacheParams::DISK) { | 226 if (http_cache_params_.type == HttpCacheParams::DISK) { |
| 225 context->StartCacheThread(); | 227 context->StartCacheThread(); |
| 226 http_cache_backend = | 228 http_cache_backend = |
| 227 new HttpCache::DefaultBackend(DISK_CACHE, | 229 new HttpCache::DefaultBackend(DISK_CACHE, |
| 228 http_cache_params_.path, | 230 http_cache_params_.path, |
| 229 http_cache_params_.max_size, | 231 http_cache_params_.max_size, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 http_transaction_factory = new HttpNetworkLayer(network_session); | 267 http_transaction_factory = new HttpNetworkLayer(network_session); |
| 266 } | 268 } |
| 267 storage->set_http_transaction_factory(http_transaction_factory); | 269 storage->set_http_transaction_factory(http_transaction_factory); |
| 268 | 270 |
| 269 // TODO(willchan): Support sdch. | 271 // TODO(willchan): Support sdch. |
| 270 | 272 |
| 271 return context; | 273 return context; |
| 272 } | 274 } |
| 273 | 275 |
| 274 } // namespace net | 276 } // namespace net |
| OLD | NEW |