| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "chrome/installer/util/browser_distribution.h" | 67 #include "chrome/installer/util/browser_distribution.h" |
| 68 #include "chrome/installer/util/chrome_frame_distribution.h" | 68 #include "chrome/installer/util/chrome_frame_distribution.h" |
| 69 #include "chrome/installer/util/google_update_settings.h" | 69 #include "chrome/installer/util/google_update_settings.h" |
| 70 #include "chrome_frame/bind_status_callback_impl.h" | 70 #include "chrome_frame/bind_status_callback_impl.h" |
| 71 #include "chrome_frame/chrome_frame_delegate.h" | 71 #include "chrome_frame/chrome_frame_delegate.h" |
| 72 #include "chrome_frame/crash_reporting/crash_metrics.h" | 72 #include "chrome_frame/crash_reporting/crash_metrics.h" |
| 73 #include "chrome_frame/html_utils.h" | 73 #include "chrome_frame/html_utils.h" |
| 74 #include "chrome_frame/http_negotiate.h" | 74 #include "chrome_frame/http_negotiate.h" |
| 75 #include "chrome_frame/utils.h" | 75 #include "chrome_frame/utils.h" |
| 76 #include "net/base/capturing_net_log.h" | 76 #include "net/base/capturing_net_log.h" |
| 77 #include "net/base/cert_verifier.h" |
| 77 #include "net/base/host_resolver.h" | 78 #include "net/base/host_resolver.h" |
| 78 #include "net/base/ssl_config_service_defaults.h" | 79 #include "net/base/ssl_config_service_defaults.h" |
| 79 #include "net/base/upload_data.h" | 80 #include "net/base/upload_data.h" |
| 80 #include "net/http/http_auth_handler_factory.h" | 81 #include "net/http/http_auth_handler_factory.h" |
| 81 #include "net/http/http_cache.h" | 82 #include "net/http/http_cache.h" |
| 82 #include "net/http/http_network_layer.h" | 83 #include "net/http/http_network_layer.h" |
| 83 #include "net/url_request/url_request_context.h" | 84 #include "net/url_request/url_request_context.h" |
| 84 #include "net/url_request/url_request_status.h" | 85 #include "net/url_request/url_request_status.h" |
| 85 | 86 |
| 86 using base::Time; | 87 using base::Time; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 99 | 100 |
| 100 Lock MetricsService::metrics_service_lock_; | 101 Lock MetricsService::metrics_service_lock_; |
| 101 | 102 |
| 102 // Traits to create an instance of the ChromeFrame upload thread. | 103 // Traits to create an instance of the ChromeFrame upload thread. |
| 103 struct UploadThreadInstanceTraits | 104 struct UploadThreadInstanceTraits |
| 104 : public base::LeakyLazyInstanceTraits<base::Thread> { | 105 : public base::LeakyLazyInstanceTraits<base::Thread> { |
| 105 static base::Thread* New(void* instance) { | 106 static base::Thread* New(void* instance) { |
| 106 // Use placement new to initialize our instance in our preallocated space. | 107 // Use placement new to initialize our instance in our preallocated space. |
| 107 // The parenthesis is very important here to force POD type initialization. | 108 // The parenthesis is very important here to force POD type initialization. |
| 108 base::Thread* upload_thread = | 109 base::Thread* upload_thread = |
| 109 new (instance) base::Thread("ChromeFrameUploadThread"); | 110 new(instance) base::Thread("ChromeFrameUploadThread"); |
| 110 base::Thread::Options options; | 111 base::Thread::Options options; |
| 111 options.message_loop_type = MessageLoop::TYPE_IO; | 112 options.message_loop_type = MessageLoop::TYPE_IO; |
| 112 bool ret = upload_thread->StartWithOptions(options); | 113 bool ret = upload_thread->StartWithOptions(options); |
| 113 if (!ret) { | 114 if (!ret) { |
| 114 NOTREACHED() << "Failed to start upload thread"; | 115 NOTREACHED() << "Failed to start upload thread"; |
| 115 } | 116 } |
| 116 return upload_thread; | 117 return upload_thread; |
| 117 } | 118 } |
| 118 }; | 119 }; |
| 119 | 120 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 136 public: | 137 public: |
| 137 explicit ChromeFrameUploadRequestContext(MessageLoop* io_loop) | 138 explicit ChromeFrameUploadRequestContext(MessageLoop* io_loop) |
| 138 : io_loop_(io_loop) { | 139 : io_loop_(io_loop) { |
| 139 Initialize(); | 140 Initialize(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 ~ChromeFrameUploadRequestContext() { | 143 ~ChromeFrameUploadRequestContext() { |
| 143 DVLOG(1) << __FUNCTION__; | 144 DVLOG(1) << __FUNCTION__; |
| 144 delete http_transaction_factory_; | 145 delete http_transaction_factory_; |
| 145 delete http_auth_handler_factory_; | 146 delete http_auth_handler_factory_; |
| 147 delete cert_verifier_; |
| 148 delete host_resolver_; |
| 146 } | 149 } |
| 147 | 150 |
| 148 void Initialize() { | 151 void Initialize() { |
| 149 user_agent_ = http_utils::GetDefaultUserAgent(); | 152 user_agent_ = http_utils::GetDefaultUserAgent(); |
| 150 user_agent_ = http_utils::AddChromeFrameToUserAgentValue( | 153 user_agent_ = http_utils::AddChromeFrameToUserAgentValue( |
| 151 user_agent_); | 154 user_agent_); |
| 152 | 155 |
| 153 host_resolver_ = | 156 host_resolver_ = |
| 154 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 157 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
| 155 NULL, NULL); | 158 NULL, NULL); |
| 159 cert_verifier_ = new net::CertVerifier; |
| 156 net::ProxyConfigService* proxy_config_service = | 160 net::ProxyConfigService* proxy_config_service = |
| 157 net::ProxyService::CreateSystemProxyConfigService(NULL, NULL); | 161 net::ProxyService::CreateSystemProxyConfigService(NULL, NULL); |
| 158 DCHECK(proxy_config_service); | 162 DCHECK(proxy_config_service); |
| 159 | 163 |
| 160 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( | 164 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( |
| 161 proxy_config_service, 0, NULL); | 165 proxy_config_service, 0, NULL); |
| 162 DCHECK(proxy_service_); | 166 DCHECK(proxy_service_); |
| 163 | 167 |
| 164 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 168 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
| 165 | 169 |
| 166 url_security_manager_.reset( | 170 url_security_manager_.reset( |
| 167 net::URLSecurityManager::Create(NULL, NULL)); | 171 net::URLSecurityManager::Create(NULL, NULL)); |
| 168 | 172 |
| 169 std::string csv_auth_schemes = "basic,digest,ntlm,negotiate"; | 173 std::string csv_auth_schemes = "basic,digest,ntlm,negotiate"; |
| 170 std::vector<std::string> supported_schemes; | 174 std::vector<std::string> supported_schemes; |
| 171 base::SplitString(csv_auth_schemes, ',', &supported_schemes); | 175 base::SplitString(csv_auth_schemes, ',', &supported_schemes); |
| 172 | 176 |
| 173 http_auth_handler_factory_ = net::HttpAuthHandlerRegistryFactory::Create( | 177 http_auth_handler_factory_ = net::HttpAuthHandlerRegistryFactory::Create( |
| 174 supported_schemes, url_security_manager_.get(), host_resolver_, | 178 supported_schemes, url_security_manager_.get(), host_resolver_, |
| 175 std::string(), false, false); | 179 std::string(), false, false); |
| 176 | 180 |
| 177 http_transaction_factory_ = new net::HttpCache( | 181 http_transaction_factory_ = new net::HttpCache( |
| 178 net::HttpNetworkLayer::CreateFactory(host_resolver_, | 182 net::HttpNetworkLayer::CreateFactory(host_resolver_, |
| 183 cert_verifier_, |
| 179 NULL /* dnsrr_resovler */, | 184 NULL /* dnsrr_resovler */, |
| 180 NULL /* dns_cert_checker*/, | 185 NULL /* dns_cert_checker*/, |
| 181 NULL /* ssl_host_info */, | 186 NULL /* ssl_host_info */, |
| 182 proxy_service_, | 187 proxy_service_, |
| 183 ssl_config_service_, | 188 ssl_config_service_, |
| 184 http_auth_handler_factory_, | 189 http_auth_handler_factory_, |
| 185 network_delegate_, | 190 network_delegate_, |
| 186 NULL), | 191 NULL), |
| 187 net::HttpCache::DefaultBackend::InMemory(0)); | 192 net::HttpCache::DefaultBackend::InMemory(0)); |
| 188 } | 193 } |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 version += "-F"; | 609 version += "-F"; |
| 605 if (!version_info.IsOfficialBuild()) | 610 if (!version_info.IsOfficialBuild()) |
| 606 version.append("-devel"); | 611 version.append("-devel"); |
| 607 return version; | 612 return version; |
| 608 } else { | 613 } else { |
| 609 NOTREACHED() << "Unable to retrieve version string."; | 614 NOTREACHED() << "Unable to retrieve version string."; |
| 610 } | 615 } |
| 611 | 616 |
| 612 return std::string(); | 617 return std::string(); |
| 613 } | 618 } |
| OLD | NEW |