• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // HWID key.
24 CHROMEOS_EXPORT extern const char kHardwareClassKey[];
25 
26 // OEM customization flag that permits exiting enterprise enrollment flow in
27 // OOBE when 'oem_enterprise_managed' flag is set.
28 CHROMEOS_EXPORT extern const char kOemCanExitEnterpriseEnrollmentKey[];
29 
30 // OEM customization directive that specified intended device purpose.
31 CHROMEOS_EXPORT extern const char kOemDeviceRequisitionKey[];
32 
33 // OEM customization flag that enforces enterprise enrollment flow in OOBE.
34 CHROMEOS_EXPORT extern const char kOemIsEnterpriseManagedKey[];
35 
36 // OEM customization flag that specifies if OOBE flow should be enhanced for
37 // keyboard driven control.
38 CHROMEOS_EXPORT extern const char kOemKeyboardDrivenOobeKey[];
39 
40 // Offer coupon code key.
41 CHROMEOS_EXPORT extern const char kOffersCouponCodeKey[];
42 
43 // Offer group key.
44 CHROMEOS_EXPORT extern const char kOffersGroupCodeKey[];
45 
46 // This interface provides access to Chrome OS statistics.
47 class CHROMEOS_EXPORT StatisticsProvider {
48  public:
49   // Starts loading the machine statistics. File operations are performed on
50   // |file_task_runner|.
51   virtual void StartLoadingMachineStatistics(
52       const scoped_refptr<base::TaskRunner>& file_task_runner,
53       bool load_oem_manifest) = 0;
54 
55   // Retrieves the named machine statistic (e.g. "hardware_class"). If |name|
56   // is found, sets |result| and returns true. Safe to call from any thread
57   // except the task runner passed to Initialize() (e.g. FILE). This may block
58   // if called early before the statistics are loaded from disk.
59   // StartLoadingMachineStatistics() must be called before this.
60   virtual bool GetMachineStatistic(const std::string& name,
61                                    std::string* result) = 0;
62 
63   // Similar to GetMachineStatistic for boolean flags.
64   virtual bool GetMachineFlag(const std::string& name, bool* result) = 0;
65 
66   // Cancels any pending file operations.
67   virtual void Shutdown() = 0;
68 
69   // Get the Singleton instance.
70   static StatisticsProvider* GetInstance();
71 
72   // Set the instance returned by GetInstance() for testing.
73   static void SetTestProvider(StatisticsProvider* test_provider);
74 
75  protected:
~StatisticsProvider()76   virtual ~StatisticsProvider() {}
77 };
78 
79 }  // namespace system
80 }  // namespace chromeos
81 
82 #endif  // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
83