| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/service/net/service_url_request_context.h" | 5 #include "chrome/service/net/service_url_request_context.h" |
| 6 | 6 |
| 7 #include "chrome/service/service_process.h" | 7 #include "chrome/service/service_process.h" |
| 8 #include "net/base/cookie_monster.h" | 8 #include "net/base/cookie_monster.h" |
| 9 #include "net/base/cookie_policy.h" | 9 #include "net/base/cookie_policy.h" |
| 10 #include "net/base/host_resolver.h" | 10 #include "net/base/host_resolver.h" |
| 11 #include "net/base/ssl_config_service_defaults.h" | 11 #include "net/base/ssl_config_service_defaults.h" |
| 12 #include "net/ftp/ftp_network_layer.h" | 12 #include "net/ftp/ftp_network_layer.h" |
| 13 #include "net/http/http_auth_handler_factory.h" | 13 #include "net/http/http_auth_handler_factory.h" |
| 14 #include "net/http/http_cache.h" | 14 #include "net/http/http_cache.h" |
| 15 #include "net/http/http_network_layer.h" | 15 #include "net/http/http_network_layer.h" |
| 16 #include "net/proxy/proxy_service.h" | 16 #include "net/proxy/proxy_service.h" |
| 17 | 17 |
| 18 ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() | 18 ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() |
| 19 : io_message_loop_proxy_( | 19 : io_message_loop_proxy_( |
| 20 g_service_process->io_thread()->message_loop_proxy()) { | 20 g_service_process->io_thread()->message_loop_proxy()) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 ServiceURLRequestContext::ServiceURLRequestContext() { | 23 ServiceURLRequestContext::ServiceURLRequestContext() { |
| 24 host_resolver_ = net::CreateSystemHostResolver(NULL); | 24 host_resolver_ = net::CreateSystemHostResolver(); |
| 25 DCHECK(g_service_process); | 25 DCHECK(g_service_process); |
| 26 // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a | 26 // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a |
| 27 // MessageLoopProxy* instead of MessageLoop*. | 27 // MessageLoopProxy* instead of MessageLoop*. |
| 28 // Also this needs to be created on the UI thread on Linux. Fix this. | 28 // Also this needs to be created on the UI thread on Linux. Fix this. |
| 29 net::ProxyConfigService * proxy_config_service = | 29 net::ProxyConfigService * proxy_config_service = |
| 30 net::ProxyService::CreateSystemProxyConfigService( | 30 net::ProxyService::CreateSystemProxyConfigService( |
| 31 g_service_process->io_thread()->message_loop(), | 31 g_service_process->io_thread()->message_loop(), |
| 32 g_service_process->file_thread()->message_loop()); | 32 g_service_process->file_thread()->message_loop()); |
| 33 proxy_service_ = net::ProxyService::Create(proxy_config_service, false, this, | 33 proxy_service_ = |
| 34 NULL, NULL, NULL); | 34 net::ProxyService::Create(proxy_config_service, false, this, NULL, NULL); |
| 35 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); | 35 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); |
| 36 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 36 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
| 37 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(); | 37 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(); |
| 38 http_transaction_factory_ = new net::HttpCache( | 38 http_transaction_factory_ = new net::HttpCache( |
| 39 net::HttpNetworkLayer::CreateFactory(NULL, host_resolver_, | 39 net::HttpNetworkLayer::CreateFactory(host_resolver_, |
| 40 proxy_service_, | 40 proxy_service_, |
| 41 ssl_config_service_, | 41 ssl_config_service_, |
| 42 http_auth_handler_factory_, | 42 http_auth_handler_factory_, |
| 43 NULL /* network_delegate */, | 43 NULL /* network_delegate */, |
| 44 NULL /* net_log */), | 44 NULL /* net_log */), |
| 45 net::HttpCache::DefaultBackend::InMemory(0)); | 45 net::HttpCache::DefaultBackend::InMemory(0)); |
| 46 // In-memory cookie store. | 46 // In-memory cookie store. |
| 47 cookie_store_ = new net::CookieMonster(NULL, NULL); | 47 cookie_store_ = new net::CookieMonster(NULL, NULL); |
| 48 accept_language_ = "en-us,fr"; | 48 accept_language_ = "en-us,fr"; |
| 49 accept_charset_ = "iso-8859-1,*,utf-8"; | 49 accept_charset_ = "iso-8859-1,*,utf-8"; |
| 50 } | 50 } |
| 51 | 51 |
| 52 ServiceURLRequestContext::~ServiceURLRequestContext() { | 52 ServiceURLRequestContext::~ServiceURLRequestContext() { |
| 53 delete ftp_transaction_factory_; | 53 delete ftp_transaction_factory_; |
| 54 delete http_transaction_factory_; | 54 delete http_transaction_factory_; |
| 55 delete http_auth_handler_factory_; | 55 delete http_auth_handler_factory_; |
| 56 } | 56 } |
| OLD | NEW |