Roll src/third_party/WebKit abe9e39c:3d349bd (svn 182659:182669)
[chromium-blink-merge.git] / chromeos / system / statistics_provider.h
blobd1dd22ca3dbd8cc4ef37f2397c03d5d00c869c65
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
6 #define CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
8 #include <string>
10 #include "base/memory/ref_counted.h"
11 #include "chromeos/chromeos_export.h"
13 namespace base {
14 class TaskRunner;
17 namespace chromeos {
18 namespace system {
20 // Developer switch value.
21 CHROMEOS_EXPORT extern const char kDevSwitchBootMode[];
23 // Customization ID key.
24 CHROMEOS_EXPORT extern const char kCustomizationIdKey[];
26 // HWID key.
27 CHROMEOS_EXPORT extern const char kHardwareClassKey[];
29 // OEM customization flag that permits exiting enterprise enrollment flow in
30 // OOBE when 'oem_enterprise_managed' flag is set.
31 CHROMEOS_EXPORT extern const char kOemCanExitEnterpriseEnrollmentKey[];
33 // OEM customization directive that specified intended device purpose.
34 CHROMEOS_EXPORT extern const char kOemDeviceRequisitionKey[];
36 // OEM customization flag that enforces enterprise enrollment flow in OOBE.
37 CHROMEOS_EXPORT extern const char kOemIsEnterpriseManagedKey[];
39 // OEM customization flag that specifies if OOBE flow should be enhanced for
40 // keyboard driven control.
41 CHROMEOS_EXPORT extern const char kOemKeyboardDrivenOobeKey[];
43 // Offer coupon code key.
44 CHROMEOS_EXPORT extern const char kOffersCouponCodeKey[];
46 // Offer group key.
47 CHROMEOS_EXPORT extern const char kOffersGroupCodeKey[];
49 // Release Brand Code key.
50 CHROMEOS_EXPORT extern const char kRlzBrandCodeKey[];
52 // This interface provides access to Chrome OS statistics.
53 class CHROMEOS_EXPORT StatisticsProvider {
54 public:
55 // Starts loading the machine statistics. File operations are performed on
56 // |file_task_runner|.
57 virtual void StartLoadingMachineStatistics(
58 const scoped_refptr<base::TaskRunner>& file_task_runner,
59 bool load_oem_manifest) = 0;
61 // Retrieves the named machine statistic (e.g. "hardware_class"). If |name|
62 // is found, sets |result| and returns true. Safe to call from any thread
63 // except the task runner passed to Initialize() (e.g. FILE). This may block
64 // if called early before the statistics are loaded from disk.
65 // StartLoadingMachineStatistics() must be called before this.
66 virtual bool GetMachineStatistic(const std::string& name,
67 std::string* result) = 0;
69 // Similar to GetMachineStatistic for boolean flags.
70 virtual bool GetMachineFlag(const std::string& name, bool* result) = 0;
72 // Cancels any pending file operations.
73 virtual void Shutdown() = 0;
75 // Get the Singleton instance.
76 static StatisticsProvider* GetInstance();
78 // Set the instance returned by GetInstance() for testing.
79 static void SetTestProvider(StatisticsProvider* test_provider);
81 protected:
82 virtual ~StatisticsProvider() {}
85 } // namespace system
86 } // namespace chromeos
88 #endif // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_