Roll src/third_party/skia 054eef2:51985e3
[chromium-blink-merge.git] / chromeos / system / statistics_provider.h
blobe70455f41dc60852d9b62d37a1f0788cc1a616cd
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 // Activation date key.
21 CHROMEOS_EXPORT extern const char kActivateDateKey[];
23 // Customization ID key.
24 CHROMEOS_EXPORT extern const char kCustomizationIdKey[];
26 // Developer switch value.
27 CHROMEOS_EXPORT extern const char kDevSwitchBootKey[];
28 CHROMEOS_EXPORT extern const char kDevSwitchBootValueVerified[];
29 CHROMEOS_EXPORT extern const char kDevSwitchBootValueDev[];
31 // Firmware type and associated values. The values are from crossystem output
32 // for the mainfw_type key. Normal and developer correspond to Chrome OS
33 // firmware with MP and developer keys respectively, nonchrome indicates the
34 // machine doesn't run on Chrome OS firmware. See crossystem source for more
35 // details.
36 CHROMEOS_EXPORT extern const char kFirmwareTypeKey[];
37 CHROMEOS_EXPORT extern const char kFirmwareTypeValueDeveloper[];
38 CHROMEOS_EXPORT extern const char kFirmwareTypeValueNonchrome[];
39 CHROMEOS_EXPORT extern const char kFirmwareTypeValueNormal[];
41 // HWID key.
42 CHROMEOS_EXPORT extern const char kHardwareClassKey[];
44 // OEM customization flag that permits exiting enterprise enrollment flow in
45 // OOBE when 'oem_enterprise_managed' flag is set.
46 CHROMEOS_EXPORT extern const char kOemCanExitEnterpriseEnrollmentKey[];
48 // OEM customization directive that specified intended device purpose.
49 CHROMEOS_EXPORT extern const char kOemDeviceRequisitionKey[];
51 // OEM customization flag that enforces enterprise enrollment flow in OOBE.
52 CHROMEOS_EXPORT extern const char kOemIsEnterpriseManagedKey[];
54 // OEM customization flag that specifies if OOBE flow should be enhanced for
55 // keyboard driven control.
56 CHROMEOS_EXPORT extern const char kOemKeyboardDrivenOobeKey[];
58 // Offer coupon code key.
59 CHROMEOS_EXPORT extern const char kOffersCouponCodeKey[];
61 // Offer group key.
62 CHROMEOS_EXPORT extern const char kOffersGroupCodeKey[];
64 // Release Brand Code key.
65 CHROMEOS_EXPORT extern const char kRlzBrandCodeKey[];
67 // Write protect switch value.
68 CHROMEOS_EXPORT extern const char kWriteProtectSwitchBootKey[];
69 CHROMEOS_EXPORT extern const char kWriteProtectSwitchBootValueOff[];
70 CHROMEOS_EXPORT extern const char kWriteProtectSwitchBootValueOn[];
72 // This interface provides access to Chrome OS statistics.
73 class CHROMEOS_EXPORT StatisticsProvider {
74 public:
75 // Starts loading the machine statistics. File operations are performed on
76 // |file_task_runner|.
77 virtual void StartLoadingMachineStatistics(
78 const scoped_refptr<base::TaskRunner>& file_task_runner,
79 bool load_oem_manifest) = 0;
81 // Retrieves the named machine statistic (e.g. "hardware_class"). If |name|
82 // is found, sets |result| and returns true. Safe to call from any thread
83 // except the task runner passed to Initialize() (e.g. FILE). This may block
84 // if called early before the statistics are loaded from disk.
85 // StartLoadingMachineStatistics() must be called before this.
86 virtual bool GetMachineStatistic(const std::string& name,
87 std::string* result) = 0;
89 // Checks whether a machine statistic is present.
90 virtual bool HasMachineStatistic(const std::string& name) = 0;
92 // Similar to GetMachineStatistic for boolean flags.
93 virtual bool GetMachineFlag(const std::string& name, bool* result) = 0;
95 // Checks whether a machine flag is present.
96 virtual bool HasMachineFlag(const std::string& name) = 0;
98 // Cancels any pending file operations.
99 virtual void Shutdown() = 0;
101 // Get the Singleton instance.
102 static StatisticsProvider* GetInstance();
104 // Set the instance returned by GetInstance() for testing.
105 static void SetTestProvider(StatisticsProvider* test_provider);
107 protected:
108 virtual ~StatisticsProvider() {}
111 } // namespace system
112 } // namespace chromeos
114 #endif // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_