Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: chromeos/system/statistics_provider.h

Issue 25112004: Move statistics_provider to chromeos/system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Similarity=33 Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ 5 #ifndef CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ 6 #define CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h"
11 #include "chromeos/chromeos_export.h"
12
13 namespace base {
14 class TaskRunner;
15 }
16
10 namespace chromeos { 17 namespace chromeos {
11 namespace system { 18 namespace system {
12 19
13 // Developer switch value. 20 // Developer switch value.
14 extern const char kDevSwitchBootMode[]; 21 CHROMEOS_EXPORT extern const char kDevSwitchBootMode[];
15 22
16 // HWID key. 23 // HWID key.
17 extern const char kHardwareClass[]; 24 CHROMEOS_EXPORT extern const char kHardwareClassKey[];
18 25
19 // OEM customization flag that permits exiting enterprise enrollment flow in 26 // OEM customization flag that permits exiting enterprise enrollment flow in
20 // OOBE when 'oem_enterprise_managed' flag is set. 27 // OOBE when 'oem_enterprise_managed' flag is set.
21 extern const char kOemCanExitEnterpriseEnrollmentKey[]; 28 CHROMEOS_EXPORT extern const char kOemCanExitEnterpriseEnrollmentKey[];
22 29
23 // OEM customization directive that specified intended device purpose. 30 // OEM customization directive that specified intended device purpose.
24 extern const char kOemDeviceRequisitionKey[]; 31 CHROMEOS_EXPORT extern const char kOemDeviceRequisitionKey[];
25 32
26 // OEM customization flag that enforces enterprise enrollment flow in OOBE. 33 // OEM customization flag that enforces enterprise enrollment flow in OOBE.
27 extern const char kOemIsEnterpriseManagedKey[]; 34 CHROMEOS_EXPORT extern const char kOemIsEnterpriseManagedKey[];
28 35
29 // OEM customization flag that specifies if OOBE flow should be enhanced for 36 // OEM customization flag that specifies if OOBE flow should be enhanced for
30 // keyboard driven control. 37 // keyboard driven control.
31 extern const char kOemKeyboardDrivenOobeKey[]; 38 CHROMEOS_EXPORT extern const char kOemKeyboardDrivenOobeKey[];
32 39
33 // Offer coupon code key. 40 // Offer coupon code key.
34 extern const char kOffersCouponCodeKey[]; 41 CHROMEOS_EXPORT extern const char kOffersCouponCodeKey[];
35 42
36 // Offer group key. 43 // Offer group key.
37 extern const char kOffersGroupCodeKey[]; 44 CHROMEOS_EXPORT extern const char kOffersGroupCodeKey[];
38 45
39 // This interface provides access to Chrome OS statistics. 46 // This interface provides access to Chrome OS statistics.
40 class StatisticsProvider { 47 class CHROMEOS_EXPORT StatisticsProvider {
41 public: 48 public:
42 // Initializes the statistics provider. 49 // Starts loading the machine statistics.
43 virtual void Init() = 0; 50 virtual void StartLoadingMachineStatistics(bool load_oem_manifest) = 0;
44 51
45 // Starts loading the machine statistcs. 52 // Retrieves the named machine statistic (e.g. "hardware_class"). If |name|
46 virtual void StartLoadingMachineStatistics() = 0; 53 // is found, sets |result| and returns true. Safe to call from any thread
47 54 // except the task runner passed to Initialize() (e.g. FILE). This may block
48 // Retrieve the named machine statistic (e.g. "hardware_class"). 55 // if called early before the statistics are loaded from disk.
49 // This does not update the statistcs. If the |name| is not set, |result| 56 // StartLoadingMachineStatistics() must be called before this.
50 // preserves old value.
51 virtual bool GetMachineStatistic(const std::string& name, 57 virtual bool GetMachineStatistic(const std::string& name,
52 std::string* result) = 0; 58 std::string* result) = 0;
53 59
54 // Retrieve boolean value for named machine flag. 60 // Similar to GetMachineStatistic for boolean flags.
55 virtual bool GetMachineFlag(const std::string& name, 61 virtual bool GetMachineFlag(const std::string& name, bool* result) = 0;
56 bool* result) = 0;
57 62
58 // Loads kiosk oem manifest file. 63 // Manage the singleton. Initialize must be called before GetInstance.
59 virtual void LoadOemManifest() = 0; 64 // |file_task_runner| is a task runner for loading files off of disk.
60 65 static void Initialize(
66 const scoped_refptr<base::TaskRunner>& file_task_runner);
67 static void Shutdown();
61 static StatisticsProvider* GetInstance(); 68 static StatisticsProvider* GetInstance();
62 69
63 protected: 70 protected:
64 virtual ~StatisticsProvider() {} 71 virtual ~StatisticsProvider() {}
65 }; 72 };
66 73
67 } // namespace system 74 } // namespace system
68 } // namespace chromeos 75 } // namespace chromeos
69 76
70 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_ 77 #endif // CHROMEOS_SYSTEM_STATISTICS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698