| 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 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ | 5 #ifndef CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ | 6 #define CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "chromeos/chromeos_export.h" |
| 12 |
| 13 namespace base { |
| 14 class TaskRunner; |
| 15 } |
| 16 |
| 10 namespace chromeos { | 17 namespace chromeos { |
| 11 namespace system { | 18 namespace system { |
| 12 | 19 |
| 13 // Developer switch value. | 20 // Developer switch value. |
| 14 extern const char kDevSwitchBootMode[]; | 21 CHROMEOS_EXPORT extern const char kDevSwitchBootMode[]; |
| 15 | 22 |
| 16 // HWID key. | 23 // HWID key. |
| 17 extern const char kHardwareClass[]; | 24 CHROMEOS_EXPORT extern const char kHardwareClassKey[]; |
| 18 | 25 |
| 19 // OEM customization flag that permits exiting enterprise enrollment flow in | 26 // OEM customization flag that permits exiting enterprise enrollment flow in |
| 20 // OOBE when 'oem_enterprise_managed' flag is set. | 27 // OOBE when 'oem_enterprise_managed' flag is set. |
| 21 extern const char kOemCanExitEnterpriseEnrollmentKey[]; | 28 CHROMEOS_EXPORT extern const char kOemCanExitEnterpriseEnrollmentKey[]; |
| 22 | 29 |
| 23 // OEM customization directive that specified intended device purpose. | 30 // OEM customization directive that specified intended device purpose. |
| 24 extern const char kOemDeviceRequisitionKey[]; | 31 CHROMEOS_EXPORT extern const char kOemDeviceRequisitionKey[]; |
| 25 | 32 |
| 26 // OEM customization flag that enforces enterprise enrollment flow in OOBE. | 33 // OEM customization flag that enforces enterprise enrollment flow in OOBE. |
| 27 extern const char kOemIsEnterpriseManagedKey[]; | 34 CHROMEOS_EXPORT extern const char kOemIsEnterpriseManagedKey[]; |
| 28 | 35 |
| 29 // OEM customization flag that specifies if OOBE flow should be enhanced for | 36 // OEM customization flag that specifies if OOBE flow should be enhanced for |
| 30 // keyboard driven control. | 37 // keyboard driven control. |
| 31 extern const char kOemKeyboardDrivenOobeKey[]; | 38 CHROMEOS_EXPORT extern const char kOemKeyboardDrivenOobeKey[]; |
| 32 | 39 |
| 33 // Offer coupon code key. | 40 // Offer coupon code key. |
| 34 extern const char kOffersCouponCodeKey[]; | 41 CHROMEOS_EXPORT extern const char kOffersCouponCodeKey[]; |
| 35 | 42 |
| 36 // Offer group key. | 43 // Offer group key. |
| 37 extern const char kOffersGroupCodeKey[]; | 44 CHROMEOS_EXPORT extern const char kOffersGroupCodeKey[]; |
| 38 | 45 |
| 39 // This interface provides access to Chrome OS statistics. | 46 // This interface provides access to Chrome OS statistics. |
| 40 class StatisticsProvider { | 47 class CHROMEOS_EXPORT StatisticsProvider { |
| 41 public: | 48 public: |
| 42 // Initializes the statistics provider. | 49 // Starts loading the machine statistics. File operations are performed on |
| 43 virtual void Init() = 0; | 50 // |file_task_runner|. |
| 51 virtual void StartLoadingMachineStatistics( |
| 52 const scoped_refptr<base::TaskRunner>& file_task_runner, |
| 53 bool load_oem_manifest) = 0; |
| 44 | 54 |
| 45 // Starts loading the machine statistcs. | 55 // Retrieves the named machine statistic (e.g. "hardware_class"). If |name| |
| 46 virtual void StartLoadingMachineStatistics() = 0; | 56 // is found, sets |result| and returns true. Safe to call from any thread |
| 47 | 57 // except the task runner passed to Initialize() (e.g. FILE). This may block |
| 48 // Retrieve the named machine statistic (e.g. "hardware_class"). | 58 // if called early before the statistics are loaded from disk. |
| 49 // This does not update the statistcs. If the |name| is not set, |result| | 59 // StartLoadingMachineStatistics() must be called before this. |
| 50 // preserves old value. | |
| 51 virtual bool GetMachineStatistic(const std::string& name, | 60 virtual bool GetMachineStatistic(const std::string& name, |
| 52 std::string* result) = 0; | 61 std::string* result) = 0; |
| 53 | 62 |
| 54 // Retrieve boolean value for named machine flag. | 63 // Similar to GetMachineStatistic for boolean flags. |
| 55 virtual bool GetMachineFlag(const std::string& name, | 64 virtual bool GetMachineFlag(const std::string& name, bool* result) = 0; |
| 56 bool* result) = 0; | |
| 57 | 65 |
| 58 // Loads kiosk oem manifest file. | 66 // Cancels any pending file operations. |
| 59 virtual void LoadOemManifest() = 0; | 67 virtual void Shutdown() = 0; |
| 60 | 68 |
| 69 // Get the Singleton instance. |
| 61 static StatisticsProvider* GetInstance(); | 70 static StatisticsProvider* GetInstance(); |
| 62 | 71 |
| 72 // Set the instance returned by GetInstance() for testing. |
| 73 static void SetTestProvider(StatisticsProvider* test_provider); |
| 74 |
| 63 protected: | 75 protected: |
| 64 virtual ~StatisticsProvider() {} | 76 virtual ~StatisticsProvider() {} |
| 65 }; | 77 }; |
| 66 | 78 |
| 67 } // namespace system | 79 } // namespace system |
| 68 } // namespace chromeos | 80 } // namespace chromeos |
| 69 | 81 |
| 70 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ | 82 #endif // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ |
| OLD | NEW |