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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 | 68 |
69 // Timeout that we should wait for statistics to get loaded | 69 // Timeout that we should wait for statistics to get loaded |
70 const int kTimeoutSecs = 3; | 70 const int kTimeoutSecs = 3; |
71 | 71 |
72 // The location of OEM manifest file used to trigger OOBE flow for kiosk mode. | 72 // The location of OEM manifest file used to trigger OOBE flow for kiosk mode. |
73 const CommandLine::CharType kOemManifestFilePath[] = | 73 const CommandLine::CharType kOemManifestFilePath[] = |
74 FILE_PATH_LITERAL("/usr/share/oem/oobe/manifest.json"); | 74 FILE_PATH_LITERAL("/usr/share/oem/oobe/manifest.json"); |
75 | 75 |
76 } // namespace | 76 } // namespace |
77 | 77 |
78 // Key values for GetMachineStatistic()/GetMachineFlag() calls. | |
79 const char kMachineInfoBoard[] = | |
80 "CHROMEOS_RELEASE_BOARD"; | |
81 const char kOffersCouponCodeKey[] = "ubind_attribute"; | |
82 const char kOffersGroupCodeKey[] = "gbind_attribute"; | |
83 const char kHardwareClass[] = "hardware_class"; | |
84 const char kOemDeviceRequisitionKey[] = | |
85 "oem_device_requisition"; | |
86 const char kOemIsEnterpriseManagedKey[] = | |
87 "oem_enterprise_managed"; | |
88 const char kOemCanExitEnterpriseEnrollmentKey[] = | |
89 "oem_can_exit_enrollment"; | |
90 const char kOemKeyboardDrivenOobeKey[] = | |
91 "oem_keyboard_driven_oobe"; | |
92 const char kDevSwitchBootMode[] = "devsw_boot"; | |
xiyuan
2013/06/18 04:59:23
nit: alpha-sort the list and follow the same order
zel
2013/06/18 17:56:37
Done.
| |
93 | |
78 // The StatisticsProvider implementation used in production. | 94 // The StatisticsProvider implementation used in production. |
79 class StatisticsProviderImpl : public StatisticsProvider { | 95 class StatisticsProviderImpl : public StatisticsProvider { |
80 public: | 96 public: |
81 // StatisticsProvider implementation: | 97 // StatisticsProvider implementation: |
82 virtual void Init() OVERRIDE; | 98 virtual void Init() OVERRIDE; |
83 virtual void StartLoadingMachineStatistics() OVERRIDE; | 99 virtual void StartLoadingMachineStatistics() OVERRIDE; |
84 virtual bool GetMachineStatistic(const std::string& name, | 100 virtual bool GetMachineStatistic(const std::string& name, |
85 std::string* result) OVERRIDE; | 101 std::string* result) OVERRIDE; |
86 virtual bool GetMachineFlag(const std::string& name, | 102 virtual bool GetMachineFlag(const std::string& name, |
87 bool* result) OVERRIDE; | 103 bool* result) OVERRIDE; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 on_statistics_loaded_.Signal(); | 261 on_statistics_loaded_.Signal(); |
246 VLOG(1) << "Finished loading statistics"; | 262 VLOG(1) << "Finished loading statistics"; |
247 } | 263 } |
248 | 264 |
249 void StatisticsProviderImpl::LoadOemManifestFromFile( | 265 void StatisticsProviderImpl::LoadOemManifestFromFile( |
250 const base::FilePath& file) { | 266 const base::FilePath& file) { |
251 KioskOemManifestParser::Manifest oem_manifest; | 267 KioskOemManifestParser::Manifest oem_manifest; |
252 if (!KioskOemManifestParser::Load(file, &oem_manifest)) | 268 if (!KioskOemManifestParser::Load(file, &oem_manifest)) |
253 return; | 269 return; |
254 | 270 |
255 machine_info_[chromeos::kOemDeviceRequisitionKey] = | 271 machine_info_[kOemDeviceRequisitionKey] = |
256 oem_manifest.device_requisition; | 272 oem_manifest.device_requisition; |
257 machine_flags_[chromeos::kOemIsEnterpriseManagedKey] = | 273 machine_flags_[kOemIsEnterpriseManagedKey] = |
258 oem_manifest.enterprise_managed; | 274 oem_manifest.enterprise_managed; |
259 machine_flags_[chromeos::kOemCanExitEnterpriseEnrollmentKey] = | 275 machine_flags_[kOemCanExitEnterpriseEnrollmentKey] = |
260 oem_manifest.can_exit_enrollment; | 276 oem_manifest.can_exit_enrollment; |
261 machine_flags_[chromeos::kOemKeyboardDrivenOobeKey] = | 277 machine_flags_[kOemKeyboardDrivenOobeKey] = |
262 oem_manifest.keyboard_driven_oobe; | 278 oem_manifest.keyboard_driven_oobe; |
263 } | 279 } |
264 | 280 |
265 StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() { | 281 StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() { |
266 return Singleton<StatisticsProviderImpl, | 282 return Singleton<StatisticsProviderImpl, |
267 DefaultSingletonTraits<StatisticsProviderImpl> >::get(); | 283 DefaultSingletonTraits<StatisticsProviderImpl> >::get(); |
268 } | 284 } |
269 | 285 |
270 // The stub StatisticsProvider implementation used on Linux desktop. | 286 // The stub StatisticsProvider implementation used on Linux desktop. |
271 class StatisticsProviderStubImpl : public StatisticsProviderImpl { | 287 class StatisticsProviderStubImpl : public StatisticsProviderImpl { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 StatisticsProvider* StatisticsProvider::GetInstance() { | 336 StatisticsProvider* StatisticsProvider::GetInstance() { |
321 if (base::chromeos::IsRunningOnChromeOS()) { | 337 if (base::chromeos::IsRunningOnChromeOS()) { |
322 return StatisticsProviderImpl::GetInstance(); | 338 return StatisticsProviderImpl::GetInstance(); |
323 } else { | 339 } else { |
324 return StatisticsProviderStubImpl::GetInstance(); | 340 return StatisticsProviderStubImpl::GetInstance(); |
325 } | 341 } |
326 } | 342 } |
327 | 343 |
328 } // namespace system | 344 } // namespace system |
329 } // namespace chromeos | 345 } // namespace chromeos |
OLD | NEW |