| 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/browser/chromeos/system/statistics_provider.h" | 5 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/task.h" | 13 #include "base/task.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "chrome/browser/chromeos/system/name_value_pairs_parser.h" | 15 #include "chrome/browser/chromeos/system/name_value_pairs_parser.h" |
| 16 #include "chrome/browser/chromeos/system/runtime_environment.h" | 16 #include "chrome/browser/chromeos/system/runtime_environment.h" |
| 17 #include "chrome/common/chrome_version_info.h" |
| 17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 18 | 19 |
| 19 using content::BrowserThread; | 20 using content::BrowserThread; |
| 20 | 21 |
| 21 namespace chromeos { | 22 namespace chromeos { |
| 22 namespace system { | 23 namespace system { |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // The tools used here should be specified as absolute paths. The | 26 // The tools used here should be specified as absolute paths. The |
| 26 // existence of the tools is checked in GetSingleValueFromTool(). | 27 // existence of the tools is checked in GetSingleValueFromTool(). |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 GetNameValuePairsFromFile(&parser, | 145 GetNameValuePairsFromFile(&parser, |
| 145 FilePath(kMachineHardwareInfoFile), | 146 FilePath(kMachineHardwareInfoFile), |
| 146 kMachineHardwareInfoEq, | 147 kMachineHardwareInfoEq, |
| 147 kMachineHardwareInfoDelim); | 148 kMachineHardwareInfoDelim); |
| 148 GetNameValuePairsFromFile(&parser, | 149 GetNameValuePairsFromFile(&parser, |
| 149 FilePath(kMachineOSInfoFile), | 150 FilePath(kMachineOSInfoFile), |
| 150 kMachineOSInfoEq, | 151 kMachineOSInfoEq, |
| 151 kMachineOSInfoDelim); | 152 kMachineOSInfoDelim); |
| 152 GetNameValuePairsFromFile(&parser, FilePath(kVpdFile), kVpdEq, kVpdDelim); | 153 GetNameValuePairsFromFile(&parser, FilePath(kVpdFile), kVpdEq, kVpdDelim); |
| 153 | 154 |
| 155 #if defined(GOOGLE_CHROME_BUILD) |
| 156 // TODO(kochi): This is for providing a channel information to |
| 157 // chrome::VersionInfo::GetChannel()/GetVersionStringModifier(), |
| 158 // but this is still late for some early customers such as |
| 159 // prerender::ConfigurePrefetchAndPrerender() and |
| 160 // ThreadWatcherList::ParseCommandLine(). |
| 161 // See http://crbug.com/107333 . |
| 162 const char kChromeOSReleaseTrack[] = "CHROMEOS_RELEASE_TRACK"; |
| 163 std::string channel; |
| 164 if (GetMachineStatistic(kChromeOSReleaseTrack, &channel)) { |
| 165 chrome::VersionInfo::SetChannel(channel); |
| 166 } |
| 167 #endif |
| 168 |
| 154 // Finished loading the statistics. | 169 // Finished loading the statistics. |
| 155 on_statistics_loaded_.Signal(); | 170 on_statistics_loaded_.Signal(); |
| 156 VLOG(1) << "Finished loading statistics"; | 171 VLOG(1) << "Finished loading statistics"; |
| 157 } | 172 } |
| 158 | 173 |
| 159 StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() { | 174 StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() { |
| 160 return Singleton<StatisticsProviderImpl, | 175 return Singleton<StatisticsProviderImpl, |
| 161 DefaultSingletonTraits<StatisticsProviderImpl> >::get(); | 176 DefaultSingletonTraits<StatisticsProviderImpl> >::get(); |
| 162 } | 177 } |
| 163 | 178 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 187 StatisticsProvider* StatisticsProvider::GetInstance() { | 202 StatisticsProvider* StatisticsProvider::GetInstance() { |
| 188 if (system::runtime_environment::IsRunningOnChromeOS()) { | 203 if (system::runtime_environment::IsRunningOnChromeOS()) { |
| 189 return StatisticsProviderImpl::GetInstance(); | 204 return StatisticsProviderImpl::GetInstance(); |
| 190 } else { | 205 } else { |
| 191 return StatisticsProviderStubImpl::GetInstance(); | 206 return StatisticsProviderStubImpl::GetInstance(); |
| 192 } | 207 } |
| 193 } | 208 } |
| 194 | 209 |
| 195 } // namespace system | 210 } // namespace system |
| 196 } // namespace chromeos | 211 } // namespace chromeos |
| OLD | NEW |