OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/system/statistics_provider.h" | 5 #include "chromeos/system/statistics_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // File to get VPD info from, and key/value delimiters of the file. | 56 // File to get VPD info from, and key/value delimiters of the file. |
57 const char kVpdFile[] = "/var/log/vpd_2.0.txt"; | 57 const char kVpdFile[] = "/var/log/vpd_2.0.txt"; |
58 const char kVpdEq[] = "="; | 58 const char kVpdEq[] = "="; |
59 const char kVpdDelim[] = "\n"; | 59 const char kVpdDelim[] = "\n"; |
60 | 60 |
61 // Timeout that we should wait for statistics to get loaded | 61 // Timeout that we should wait for statistics to get loaded |
62 const int kTimeoutSecs = 3; | 62 const int kTimeoutSecs = 3; |
63 | 63 |
64 // The location of OEM manifest file used to trigger OOBE flow for kiosk mode. | 64 // The location of OEM manifest file used to trigger OOBE flow for kiosk mode. |
65 const CommandLine::CharType kOemManifestFilePath[] = | 65 const base::CommandLine::CharType kOemManifestFilePath[] = |
66 FILE_PATH_LITERAL("/usr/share/oem/oobe/manifest.json"); | 66 FILE_PATH_LITERAL("/usr/share/oem/oobe/manifest.json"); |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 // Key values for GetMachineStatistic()/GetMachineFlag() calls. | 70 // Key values for GetMachineStatistic()/GetMachineFlag() calls. |
71 const char kActivateDateKey[] = "ActivateDate"; | 71 const char kActivateDateKey[] = "ActivateDate"; |
72 const char kCustomizationIdKey[] = "customization_id"; | 72 const char kCustomizationIdKey[] = "customization_id"; |
73 const char kDevSwitchBootMode[] = "devsw_boot"; | 73 const char kDevSwitchBootMode[] = "devsw_boot"; |
74 const char kFirmwareTypeKey[] = "mainfw_type"; | 74 const char kFirmwareTypeKey[] = "mainfw_type"; |
75 const char kFirmwareTypeValueDeveloper[] = "developer"; | 75 const char kFirmwareTypeValueDeveloper[] = "developer"; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // Ensure that the hardware class key is present with the expected | 291 // Ensure that the hardware class key is present with the expected |
292 // key name, and if it couldn't be retrieved, that the value is "unknown". | 292 // key name, and if it couldn't be retrieved, that the value is "unknown". |
293 std::string hardware_class = machine_info_[kHardwareClassCrosSystemKey]; | 293 std::string hardware_class = machine_info_[kHardwareClassCrosSystemKey]; |
294 if (hardware_class.empty() || hardware_class == kCrosSystemUnknownValue) | 294 if (hardware_class.empty() || hardware_class == kCrosSystemUnknownValue) |
295 machine_info_[kHardwareClassKey] = kUnknownHardwareClass; | 295 machine_info_[kHardwareClassKey] = kUnknownHardwareClass; |
296 else | 296 else |
297 machine_info_[kHardwareClassKey] = hardware_class; | 297 machine_info_[kHardwareClassKey] = hardware_class; |
298 | 298 |
299 if (load_oem_manifest) { | 299 if (load_oem_manifest) { |
300 // If kAppOemManifestFile switch is specified, load OEM Manifest file. | 300 // If kAppOemManifestFile switch is specified, load OEM Manifest file. |
301 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 301 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
302 if (command_line->HasSwitch(switches::kAppOemManifestFile)) { | 302 if (command_line->HasSwitch(switches::kAppOemManifestFile)) { |
303 LoadOemManifestFromFile( | 303 LoadOemManifestFromFile( |
304 command_line->GetSwitchValuePath(switches::kAppOemManifestFile)); | 304 command_line->GetSwitchValuePath(switches::kAppOemManifestFile)); |
305 } else if (base::SysInfo::IsRunningOnChromeOS()) { | 305 } else if (base::SysInfo::IsRunningOnChromeOS()) { |
306 LoadOemManifestFromFile(base::FilePath(kOemManifestFilePath)); | 306 LoadOemManifestFromFile(base::FilePath(kOemManifestFilePath)); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 // Finished loading the statistics. | 310 // Finished loading the statistics. |
311 on_statistics_loaded_.Signal(); | 311 on_statistics_loaded_.Signal(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 return StatisticsProviderImpl::GetInstance(); | 350 return StatisticsProviderImpl::GetInstance(); |
351 } | 351 } |
352 | 352 |
353 // static | 353 // static |
354 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { | 354 void StatisticsProvider::SetTestProvider(StatisticsProvider* test_provider) { |
355 g_test_statistics_provider = test_provider; | 355 g_test_statistics_provider = test_provider; |
356 } | 356 } |
357 | 357 |
358 } // namespace system | 358 } // namespace system |
359 } // namespace chromeos | 359 } // namespace chromeos |
OLD | NEW |