| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 8 #include <sys/utsname.h> | 8 #include <sys/utsname.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "chrome/common/chrome_version_info.h" | 14 #include "chrome/common/chrome_version_info.h" |
| 15 #include "chrome/service/service_process.h" | 15 #include "chrome/service/service_process.h" |
| 16 #include "net/base/cert_verifier.h" | 16 #include "net/base/cert_verifier.h" |
| 17 #include "net/base/cookie_monster.h" | 17 #include "net/base/cookie_monster.h" |
| 18 #include "net/base/cookie_policy.h" | 18 #include "net/base/cookie_policy.h" |
| 19 #include "net/base/dnsrr_resolver.h" | 19 #include "net/base/dnsrr_resolver.h" |
| 20 #include "net/base/host_resolver.h" | 20 #include "net/base/host_resolver.h" |
| 21 #include "net/base/ssl_config_service_defaults.h" | 21 #include "net/base/ssl_config_service_defaults.h" |
| 22 #include "net/ftp/ftp_network_layer.h" | 22 #include "net/ftp/ftp_network_layer.h" |
| 23 #include "net/http/http_auth_handler_factory.h" | 23 #include "net/http/http_auth_handler_factory.h" |
| 24 #include "net/http/http_cache.h" | 24 #include "net/http/http_cache.h" |
| 25 #include "net/http/http_network_layer.h" | 25 #include "net/http/http_network_session.h" |
| 26 #include "net/socket/client_socket_factory.h" |
| 27 #include "net/spdy/spdy_session_pool.h" |
| 26 #include "net/proxy/proxy_service.h" | 28 #include "net/proxy/proxy_service.h" |
| 27 | 29 |
| 28 namespace { | 30 namespace { |
| 29 // Copied from webkit/glue/user_agent.cc. We don't want to pull in a dependency | 31 // Copied from webkit/glue/user_agent.cc. We don't want to pull in a dependency |
| 30 // on webkit/glue which also pulls in the renderer. Also our user-agent is | 32 // on webkit/glue which also pulls in the renderer. Also our user-agent is |
| 31 // totally different from the user-agent used by the browser, just the | 33 // totally different from the user-agent used by the browser, just the |
| 32 // OS-specific parts are common. | 34 // OS-specific parts are common. |
| 33 std::string BuildOSCpuInfo() { | 35 std::string BuildOSCpuInfo() { |
| 34 std::string os_cpu; | 36 std::string os_cpu; |
| 35 | 37 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 g_service_process->io_thread()->message_loop(), | 119 g_service_process->io_thread()->message_loop(), |
| 118 g_service_process->file_thread()->message_loop()); | 120 g_service_process->file_thread()->message_loop()); |
| 119 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( | 121 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( |
| 120 proxy_config_service, 0u, NULL); | 122 proxy_config_service, 0u, NULL); |
| 121 cert_verifier_ = new net::CertVerifier; | 123 cert_verifier_ = new net::CertVerifier; |
| 122 dnsrr_resolver_ = new net::DnsRRResolver; | 124 dnsrr_resolver_ = new net::DnsRRResolver; |
| 123 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); | 125 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); |
| 124 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 126 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
| 125 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( | 127 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( |
| 126 host_resolver_); | 128 host_resolver_); |
| 129 scoped_refptr<net::HttpNetworkSession> network_session( |
| 130 new net::HttpNetworkSession( |
| 131 host_resolver_, |
| 132 cert_verifier_, |
| 133 dnsrr_resolver_, |
| 134 NULL /* dns_cert_checker */, |
| 135 NULL /* ssl_host_info_factory */, |
| 136 proxy_service_, |
| 137 net::ClientSocketFactory::GetDefaultFactory(), |
| 138 ssl_config_service_, |
| 139 new net::SpdySessionPool(NULL), |
| 140 http_auth_handler_factory_, |
| 141 NULL /* network_delegate */, |
| 142 NULL /* net_log */)); |
| 127 http_transaction_factory_ = new net::HttpCache( | 143 http_transaction_factory_ = new net::HttpCache( |
| 128 net::HttpNetworkLayer::CreateFactory(host_resolver_, | 144 network_session, |
| 129 cert_verifier_, | |
| 130 dnsrr_resolver_, | |
| 131 NULL /* dns_cert_checker */, | |
| 132 NULL /* ssl_host_info_factory */, | |
| 133 proxy_service_, | |
| 134 ssl_config_service_, | |
| 135 http_auth_handler_factory_, | |
| 136 NULL /* network_delegate */, | |
| 137 NULL /* net_log */), | |
| 138 NULL /* net_log */, | |
| 139 net::HttpCache::DefaultBackend::InMemory(0)); | 145 net::HttpCache::DefaultBackend::InMemory(0)); |
| 140 // In-memory cookie store. | 146 // In-memory cookie store. |
| 141 cookie_store_ = new net::CookieMonster(NULL, NULL); | 147 cookie_store_ = new net::CookieMonster(NULL, NULL); |
| 142 accept_language_ = "en-us,fr"; | 148 accept_language_ = "en-us,fr"; |
| 143 accept_charset_ = "iso-8859-1,*,utf-8"; | 149 accept_charset_ = "iso-8859-1,*,utf-8"; |
| 144 } | 150 } |
| 145 | 151 |
| 146 const std::string& ServiceURLRequestContext::GetUserAgent( | 152 const std::string& ServiceURLRequestContext::GetUserAgent( |
| 147 const GURL& url) const { | 153 const GURL& url) const { |
| 148 // If the user agent is set explicitly return that, otherwise call the | 154 // If the user agent is set explicitly return that, otherwise call the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 172 url_request_context_ = new ServiceURLRequestContext(user_agent_); | 178 url_request_context_ = new ServiceURLRequestContext(user_agent_); |
| 173 return url_request_context_; | 179 return url_request_context_; |
| 174 } | 180 } |
| 175 | 181 |
| 176 scoped_refptr<base::MessageLoopProxy> | 182 scoped_refptr<base::MessageLoopProxy> |
| 177 ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const { | 183 ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const { |
| 178 return io_message_loop_proxy_; | 184 return io_message_loop_proxy_; |
| 179 } | 185 } |
| 180 | 186 |
| 181 ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} | 187 ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {} |
| OLD | NEW |