Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / chromeos / system / statistics_provider.h
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.
4
5 #ifndef CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
6 #define CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "chromeos/chromeos_export.h"
12
13 namespace base {
14 class TaskRunner;
15 }
16
17 namespace chromeos {
18 namespace system {
19
20 // Developer switch value.
21 CHROMEOS_EXPORT extern const char kDevSwitchBootMode[];
22
23 // Customization ID key.
24 CHROMEOS_EXPORT extern const char kCustomizationIdKey[];
25
26 // HWID key.
27 CHROMEOS_EXPORT extern const char kHardwareClassKey[];
28
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[];
32
33 // OEM customization directive that specified intended device purpose.
34 CHROMEOS_EXPORT extern const char kOemDeviceRequisitionKey[];
35
36 // OEM customization flag that enforces enterprise enrollment flow in OOBE.
37 CHROMEOS_EXPORT extern const char kOemIsEnterpriseManagedKey[];
38
39 // OEM customization flag that specifies if OOBE flow should be enhanced for
40 // keyboard driven control.
41 CHROMEOS_EXPORT extern const char kOemKeyboardDrivenOobeKey[];
42
43 // Offer coupon code key.
44 CHROMEOS_EXPORT extern const char kOffersCouponCodeKey[];
45
46 // Offer group key.
47 CHROMEOS_EXPORT extern const char kOffersGroupCodeKey[];
48
49 // Release Brand Code key.
50 CHROMEOS_EXPORT extern const char kRlzBrandCodeKey[];
51
52 // The serial number of the disk the root device is on.
53 CHROMEOS_EXPORT extern const char kDiskSerialNumber[];
54
55 // This interface provides access to Chrome OS statistics.
56 class CHROMEOS_EXPORT StatisticsProvider {
57  public:
58   // Starts loading the machine statistics. File operations are performed on
59   // |file_task_runner|.
60   virtual void StartLoadingMachineStatistics(
61       const scoped_refptr<base::TaskRunner>& file_task_runner,
62       bool load_oem_manifest) = 0;
63
64   // Retrieves the named machine statistic (e.g. "hardware_class"). If |name|
65   // is found, sets |result| and returns true. Safe to call from any thread
66   // except the task runner passed to Initialize() (e.g. FILE). This may block
67   // if called early before the statistics are loaded from disk.
68   // StartLoadingMachineStatistics() must be called before this.
69   virtual bool GetMachineStatistic(const std::string& name,
70                                    std::string* result) = 0;
71
72   // Similar to GetMachineStatistic for boolean flags.
73   virtual bool GetMachineFlag(const std::string& name, bool* result) = 0;
74
75   // Cancels any pending file operations.
76   virtual void Shutdown() = 0;
77
78   // Get the Singleton instance.
79   static StatisticsProvider* GetInstance();
80
81   // Set the instance returned by GetInstance() for testing.
82   static void SetTestProvider(StatisticsProvider* test_provider);
83
84  protected:
85   virtual ~StatisticsProvider() {}
86 };
87
88 }  // namespace system
89 }  // namespace chromeos
90
91 #endif  // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_