| 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 | 5 |
| 6 //------------------------------------------------------------------------------ | 6 //------------------------------------------------------------------------------ |
| 7 // Description of the life cycle of a instance of MetricsService. | 7 // Description of the life cycle of a instance of MetricsService. |
| 8 // | 8 // |
| 9 // OVERVIEW | 9 // OVERVIEW |
| 10 // | 10 // |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 g_metrics_upload_thread_(base::LINKER_INITIALIZED); | 124 g_metrics_upload_thread_(base::LINKER_INITIALIZED); |
| 125 | 125 |
| 126 Lock g_metrics_service_lock; | 126 Lock g_metrics_service_lock; |
| 127 | 127 |
| 128 extern base::LazyInstance<StatisticsRecorder> g_statistics_recorder_; | 128 extern base::LazyInstance<StatisticsRecorder> g_statistics_recorder_; |
| 129 | 129 |
| 130 // This class provides HTTP request context information for metrics upload | 130 // This class provides HTTP request context information for metrics upload |
| 131 // requests initiated by ChromeFrame. | 131 // requests initiated by ChromeFrame. |
| 132 class ChromeFrameUploadRequestContext : public URLRequestContext { | 132 class ChromeFrameUploadRequestContext : public URLRequestContext { |
| 133 public: | 133 public: |
| 134 ChromeFrameUploadRequestContext(MessageLoop* io_loop) | 134 explicit ChromeFrameUploadRequestContext(MessageLoop* io_loop) |
| 135 : io_loop_(io_loop) { | 135 : io_loop_(io_loop) { |
| 136 Initialize(); | 136 Initialize(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 ~ChromeFrameUploadRequestContext() { | 139 ~ChromeFrameUploadRequestContext() { |
| 140 DLOG(INFO) << __FUNCTION__; | 140 DLOG(INFO) << __FUNCTION__; |
| 141 delete http_transaction_factory_; | 141 delete http_transaction_factory_; |
| 142 delete http_auth_handler_factory_; | 142 delete http_auth_handler_factory_; |
| 143 } | 143 } |
| 144 | 144 |
| 145 void Initialize() { | 145 void Initialize() { |
| 146 user_agent_ = http_utils::GetDefaultUserAgent(); | 146 user_agent_ = http_utils::GetDefaultUserAgent(); |
| 147 user_agent_ = http_utils::AddChromeFrameToUserAgentValue( | 147 user_agent_ = http_utils::AddChromeFrameToUserAgentValue( |
| 148 user_agent_); | 148 user_agent_); |
| 149 | 149 |
| 150 host_resolver_ = | 150 host_resolver_ = |
| 151 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 151 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
| 152 NULL); | 152 NULL); |
| 153 net::ProxyConfigService* proxy_config_service = | 153 net::ProxyConfigService* proxy_config_service = |
| 154 net::ProxyService::CreateSystemProxyConfigService(NULL, NULL); | 154 net::ProxyService::CreateSystemProxyConfigService(NULL, NULL); |
| 155 DCHECK(proxy_config_service); | 155 DCHECK(proxy_config_service); |
| 156 | 156 |
| 157 const size_t kNetLogBound = 50u; | 157 const size_t kNetLogBound = 50u; |
| 158 net_log_.reset(new net::CapturingNetLog(kNetLogBound)); | 158 net_log_.reset(new net::CapturingNetLog(kNetLogBound)); |
| 159 | 159 |
| 160 proxy_service_ = net::ProxyService::Create(proxy_config_service, false, 0, | 160 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( |
| 161 this, net_log_.get(), io_loop_); | 161 proxy_config_service, 0, net_log_.get()); |
| 162 DCHECK(proxy_service_); | 162 DCHECK(proxy_service_); |
| 163 | 163 |
| 164 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 164 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
| 165 | 165 |
| 166 url_security_manager_.reset( | 166 url_security_manager_.reset( |
| 167 net::URLSecurityManager::Create(NULL, NULL)); | 167 net::URLSecurityManager::Create(NULL, NULL)); |
| 168 | 168 |
| 169 std::string csv_auth_schemes = "basic,digest,ntlm,negotiate"; | 169 std::string csv_auth_schemes = "basic,digest,ntlm,negotiate"; |
| 170 std::vector<std::string> supported_schemes; | 170 std::vector<std::string> supported_schemes; |
| 171 SplitString(csv_auth_schemes, ',', &supported_schemes); | 171 SplitString(csv_auth_schemes, ',', &supported_schemes); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 193 std::string user_agent_; | 193 std::string user_agent_; |
| 194 MessageLoop* io_loop_; | 194 MessageLoop* io_loop_; |
| 195 scoped_ptr<net::NetLog> net_log_; | 195 scoped_ptr<net::NetLog> net_log_; |
| 196 scoped_ptr<net::URLSecurityManager> url_security_manager_; | 196 scoped_ptr<net::URLSecurityManager> url_security_manager_; |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 // This class provides an interface to retrieve the URL request context for | 199 // This class provides an interface to retrieve the URL request context for |
| 200 // metrics HTTP upload requests initiated by ChromeFrame. | 200 // metrics HTTP upload requests initiated by ChromeFrame. |
| 201 class ChromeFrameUploadRequestContextGetter : public URLRequestContextGetter { | 201 class ChromeFrameUploadRequestContextGetter : public URLRequestContextGetter { |
| 202 public: | 202 public: |
| 203 ChromeFrameUploadRequestContextGetter(MessageLoop* io_loop) | 203 explicit ChromeFrameUploadRequestContextGetter(MessageLoop* io_loop) |
| 204 : io_loop_(io_loop) {} | 204 : io_loop_(io_loop) {} |
| 205 | 205 |
| 206 virtual URLRequestContext* GetURLRequestContext() { | 206 virtual URLRequestContext* GetURLRequestContext() { |
| 207 if (!context_) | 207 if (!context_) |
| 208 context_ = new ChromeFrameUploadRequestContext(io_loop_); | 208 context_ = new ChromeFrameUploadRequestContext(io_loop_); |
| 209 return context_; | 209 return context_; |
| 210 } | 210 } |
| 211 | 211 |
| 212 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { | 212 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { |
| 213 if (!io_message_loop_proxy_.get()) { | 213 if (!io_message_loop_proxy_.get()) { |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 version += "-F"; | 599 version += "-F"; |
| 600 if (!version_info.IsOfficialBuild()) | 600 if (!version_info.IsOfficialBuild()) |
| 601 version.append("-devel"); | 601 version.append("-devel"); |
| 602 return version; | 602 return version; |
| 603 } else { | 603 } else { |
| 604 NOTREACHED() << "Unable to retrieve version string."; | 604 NOTREACHED() << "Unable to retrieve version string."; |
| 605 } | 605 } |
| 606 | 606 |
| 607 return std::string(); | 607 return std::string(); |
| 608 } | 608 } |
| OLD | NEW |