| 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 #ifndef CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ | 5 #ifndef CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ |
| 6 #define 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" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // This interface provides access to Chrome OS statistics. | 91 // This interface provides access to Chrome OS statistics. |
| 92 class CHROMEOS_EXPORT StatisticsProvider { | 92 class CHROMEOS_EXPORT StatisticsProvider { |
| 93 public: | 93 public: |
| 94 // Starts loading the machine statistics. File operations are performed on | 94 // Starts loading the machine statistics. File operations are performed on |
| 95 // |file_task_runner|. | 95 // |file_task_runner|. |
| 96 virtual void StartLoadingMachineStatistics( | 96 virtual void StartLoadingMachineStatistics( |
| 97 const scoped_refptr<base::TaskRunner>& file_task_runner, | 97 const scoped_refptr<base::TaskRunner>& file_task_runner, |
| 98 bool load_oem_manifest) = 0; | 98 bool load_oem_manifest) = 0; |
| 99 | 99 |
| 100 // Returns true if the named machine statistic (e.g. "hardware_class") is | 100 // Returns true if the named machine statistic (e.g. "hardware_class") is |
| 101 // found and stores it in |result| (if provided). Probing for the existance of | 101 // found and stores it in |result| (if provided). Probing for the existence of |
| 102 // a statistic by setting |result| to nullptr supresses the usual warning in | 102 // a statistic by setting |result| to nullptr supresses the usual warning in |
| 103 // case the statistic is not found. Safe to call from any thread except the | 103 // case the statistic is not found. Safe to call from any thread except the |
| 104 // task runner passed to Initialize() (e.g. FILE). This may block if called | 104 // task runner passed to Initialize() (e.g. FILE). This may block if called |
| 105 // early before the statistics are loaded from disk. | 105 // early before the statistics are loaded from disk. |
| 106 // StartLoadingMachineStatistics() must be called before this. | 106 // StartLoadingMachineStatistics() must be called before this. |
| 107 virtual bool GetMachineStatistic(const std::string& name, | 107 virtual bool GetMachineStatistic(const std::string& name, |
| 108 std::string* result) = 0; | 108 std::string* result) = 0; |
| 109 | 109 |
| 110 // Similar to GetMachineStatistic for boolean flags. | 110 // Similar to GetMachineStatistic for boolean flags. |
| 111 virtual bool GetMachineFlag(const std::string& name, bool* result) = 0; | 111 virtual bool GetMachineFlag(const std::string& name, bool* result) = 0; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 132 static void SetTestProvider(StatisticsProvider* test_provider); | 132 static void SetTestProvider(StatisticsProvider* test_provider); |
| 133 | 133 |
| 134 protected: | 134 protected: |
| 135 virtual ~StatisticsProvider() {} | 135 virtual ~StatisticsProvider() {} |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace system | 138 } // namespace system |
| 139 } // namespace chromeos | 139 } // namespace chromeos |
| 140 | 140 |
| 141 #endif // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ | 141 #endif // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ |
| OLD | NEW |