summaryrefslogtreecommitdiffstats
path: root/chromeos/system/statistics_provider.h
blob: d1dd22ca3dbd8cc4ef37f2397c03d5d00c869c65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
#define CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_

#include <string>

#include "base/memory/ref_counted.h"
#include "chromeos/chromeos_export.h"

namespace base {
class TaskRunner;
}

namespace chromeos {
namespace system {

// Developer switch value.
CHROMEOS_EXPORT extern const char kDevSwitchBootMode[];

// Customization ID key.
CHROMEOS_EXPORT extern const char kCustomizationIdKey[];

// HWID key.
CHROMEOS_EXPORT extern const char kHardwareClassKey[];

// OEM customization flag that permits exiting enterprise enrollment flow in
// OOBE when 'oem_enterprise_managed' flag is set.
CHROMEOS_EXPORT extern const char kOemCanExitEnterpriseEnrollmentKey[];

// OEM customization directive that specified intended device purpose.
CHROMEOS_EXPORT extern const char kOemDeviceRequisitionKey[];

// OEM customization flag that enforces enterprise enrollment flow in OOBE.
CHROMEOS_EXPORT extern const char kOemIsEnterpriseManagedKey[];

// OEM customization flag that specifies if OOBE flow should be enhanced for
// keyboard driven control.
CHROMEOS_EXPORT extern const char kOemKeyboardDrivenOobeKey[];

// Offer coupon code key.
CHROMEOS_EXPORT extern const char kOffersCouponCodeKey[];

// Offer group key.
CHROMEOS_EXPORT extern const char kOffersGroupCodeKey[];

// Release Brand Code key.
CHROMEOS_EXPORT extern const char kRlzBrandCodeKey[];

// This interface provides access to Chrome OS statistics.
class CHROMEOS_EXPORT StatisticsProvider {
 public:
  // Starts loading the machine statistics. File operations are performed on
  // |file_task_runner|.
  virtual void StartLoadingMachineStatistics(
      const scoped_refptr<base::TaskRunner>& file_task_runner,
      bool load_oem_manifest) = 0;

  // Retrieves the named machine statistic (e.g. "hardware_class"). If |name|
  // is found, sets |result| and returns true. Safe to call from any thread
  // except the task runner passed to Initialize() (e.g. FILE). This may block
  // if called early before the statistics are loaded from disk.
  // StartLoadingMachineStatistics() must be called before this.
  virtual bool GetMachineStatistic(const std::string& name,
                                   std::string* result) = 0;

  // Similar to GetMachineStatistic for boolean flags.
  virtual bool GetMachineFlag(const std::string& name, bool* result) = 0;

  // Cancels any pending file operations.
  virtual void Shutdown() = 0;

  // Get the Singleton instance.
  static StatisticsProvider* GetInstance();

  // Set the instance returned by GetInstance() for testing.
  static void SetTestProvider(StatisticsProvider* test_provider);

 protected:
  virtual ~StatisticsProvider() {}
};

}  // namespace system
}  // namespace chromeos

#endif  // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_