Index: chrome/browser/chromeos/system/statistics_provider.h |
diff --git a/chrome/browser/chromeos/system/statistics_provider.h b/chrome/browser/chromeos/system/statistics_provider.h |
index 1908087826ccb6b91d74b66b56b69ea3cdbde80e..413453a29052f4c543ec237be3467077959a778c 100644 |
--- a/chrome/browser/chromeos/system/statistics_provider.h |
+++ b/chrome/browser/chromeos/system/statistics_provider.h |
@@ -8,18 +8,31 @@ |
#include <string> |
+#include "base/callback.h" |
+ |
namespace chromeos { |
namespace system { |
// This interface provides access to Chrome OS statistics. |
class StatisticsProvider { |
public: |
- // Retrieve the named machine statistic (e.g. "hardware_class"). |
- // This does not update the statistcs. If the |name| is not set, |result| |
- // preserves old value. |
+ // Get the machine statistic with a key of |name| (e.g., "hardware_class"). |
+ // Returns true if the key was found, and data was returned in |result|. |
+ // Returns false otherwise, and the contents of |result| are undefined. |
+ // This call may block for an arbitrary length of time (waiting for statistics |
+ // to load, or a timeout to take place). If this function is called anytime |
+ // after WhenReady() has invoked any callback, then this function is |
+ // guaranteed not to block. |
virtual bool GetMachineStatistic(const std::string& name, |
std::string* result) = 0; |
+ // Invokes |callback| on the UI loop once the statistics have been loaded. |
+ // |callback| is immediately posted to the UI loop if the statistics are |
+ // already available. All the statistics are available once |callback| is |
+ // invoked, and GetMachineStatistic() can be invoked as many times as |
+ // desired without blocking. |
+ virtual void WhenReady(const base::Closure& callback) = 0; |
+ |
static StatisticsProvider* GetInstance(); |
protected: |