| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // File to get machine hardware info from, and key/value delimiters of | 39 // File to get machine hardware info from, and key/value delimiters of |
| 40 // the file. | 40 // the file. |
| 41 // /tmp/machine-info is generated by platform/init/chromeos_startup. | 41 // /tmp/machine-info is generated by platform/init/chromeos_startup. |
| 42 const char kMachineHardwareInfoFile[] = "/tmp/machine-info"; | 42 const char kMachineHardwareInfoFile[] = "/tmp/machine-info"; |
| 43 const char kMachineHardwareInfoEq[] = "="; | 43 const char kMachineHardwareInfoEq[] = "="; |
| 44 const char kMachineHardwareInfoDelim[] = " \n"; | 44 const char kMachineHardwareInfoDelim[] = " \n"; |
| 45 | 45 |
| 46 // File to get ECHO coupon info from, and key/value delimiters of | 46 // File to get ECHO coupon info from, and key/value delimiters of |
| 47 // the file. | 47 // the file. |
| 48 const char kOffersCouponFile[] = "/var/cache/offers/vpd_echo.txt"; | 48 const char kEchoCouponFile[] = "/var/cache/echo/vpd_echo.txt"; |
| 49 const char kOffersCouponEq[] = "="; | 49 const char kEchoCouponEq[] = "="; |
| 50 const char kOffersCouponDelim[] = "\n"; | 50 const char kEchoCouponDelim[] = "\n"; |
| 51 | 51 |
| 52 // File to get machine OS info from, and key/value delimiters of the file. | 52 // File to get machine OS info from, and key/value delimiters of the file. |
| 53 const char kMachineOSInfoFile[] = "/etc/lsb-release"; | 53 const char kMachineOSInfoFile[] = "/etc/lsb-release"; |
| 54 const char kMachineOSInfoEq[] = "="; | 54 const char kMachineOSInfoEq[] = "="; |
| 55 const char kMachineOSInfoDelim[] = "\n"; | 55 const char kMachineOSInfoDelim[] = "\n"; |
| 56 | 56 |
| 57 // File to get VPD info from, and key/value delimiters of the file. | 57 // File to get VPD info from, and key/value delimiters of the file. |
| 58 const char kVpdFile[] = "/var/log/vpd_2.0.txt"; | 58 const char kVpdFile[] = "/var/log/vpd_2.0.txt"; |
| 59 const char kVpdEq[] = "="; | 59 const char kVpdEq[] = "="; |
| 60 const char kVpdDelim[] = "\n"; | 60 const char kVpdDelim[] = "\n"; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // key name, and if it couldn't be retrieved, that the value is "unknown". | 147 // key name, and if it couldn't be retrieved, that the value is "unknown". |
| 148 std::string hardware_class = machine_info_[kHardwareClassCrosSystemKey]; | 148 std::string hardware_class = machine_info_[kHardwareClassCrosSystemKey]; |
| 149 if (hardware_class.empty() || hardware_class == kCrosSystemUnknownValue) | 149 if (hardware_class.empty() || hardware_class == kCrosSystemUnknownValue) |
| 150 machine_info_[kHardwareClassKey] = kUnknownHardwareClass; | 150 machine_info_[kHardwareClassKey] = kUnknownHardwareClass; |
| 151 else | 151 else |
| 152 machine_info_[kHardwareClassKey] = hardware_class; | 152 machine_info_[kHardwareClassKey] = hardware_class; |
| 153 | 153 |
| 154 parser.GetNameValuePairsFromFile(FilePath(kMachineHardwareInfoFile), | 154 parser.GetNameValuePairsFromFile(FilePath(kMachineHardwareInfoFile), |
| 155 kMachineHardwareInfoEq, | 155 kMachineHardwareInfoEq, |
| 156 kMachineHardwareInfoDelim); | 156 kMachineHardwareInfoDelim); |
| 157 parser.GetNameValuePairsFromFile(FilePath(kOffersCouponFile), | 157 parser.GetNameValuePairsFromFile(FilePath(kEchoCouponFile), |
| 158 kOffersCouponEq, | 158 kEchoCouponEq, |
| 159 kOffersCouponDelim); | 159 kEchoCouponDelim); |
| 160 parser.GetNameValuePairsFromFile(FilePath(kMachineOSInfoFile), | 160 parser.GetNameValuePairsFromFile(FilePath(kMachineOSInfoFile), |
| 161 kMachineOSInfoEq, | 161 kMachineOSInfoEq, |
| 162 kMachineOSInfoDelim); | 162 kMachineOSInfoDelim); |
| 163 parser.GetNameValuePairsFromFile(FilePath(kVpdFile), kVpdEq, kVpdDelim); | 163 parser.GetNameValuePairsFromFile(FilePath(kVpdFile), kVpdEq, kVpdDelim); |
| 164 | 164 |
| 165 // Finished loading the statistics. | 165 // Finished loading the statistics. |
| 166 on_statistics_loaded_.Signal(); | 166 on_statistics_loaded_.Signal(); |
| 167 VLOG(1) << "Finished loading statistics"; | 167 VLOG(1) << "Finished loading statistics"; |
| 168 | 168 |
| 169 #if defined(GOOGLE_CHROME_BUILD) | 169 #if defined(GOOGLE_CHROME_BUILD) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 StatisticsProvider* StatisticsProvider::GetInstance() { | 221 StatisticsProvider* StatisticsProvider::GetInstance() { |
| 222 if (base::chromeos::IsRunningOnChromeOS()) { | 222 if (base::chromeos::IsRunningOnChromeOS()) { |
| 223 return StatisticsProviderImpl::GetInstance(); | 223 return StatisticsProviderImpl::GetInstance(); |
| 224 } else { | 224 } else { |
| 225 return StatisticsProviderStubImpl::GetInstance(); | 225 return StatisticsProviderStubImpl::GetInstance(); |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace system | 229 } // namespace system |
| 230 } // namespace chromeos | 230 } // namespace chromeos |
| OLD | NEW |