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