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

Side by Side Diff: chrome/browser/policy/device_status_collector.h

Issue 9289017: Apply individual policies for the various parts of device status reports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Julian's comments. Created 8 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_POLICY_DEVICE_STATUS_COLLECTOR_H_ 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ 6 #define CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/timer.h" 10 #include "base/timer.h"
11 #include "chrome/browser/chromeos/version_loader.h" 11 #include "chrome/browser/chromeos/version_loader.h"
12 #include "chrome/browser/idle.h" 12 #include "chrome/browser/idle.h"
13 #include "content/public/browser/notification_observer.h"
13 14
14 namespace chromeos { 15 namespace chromeos {
16 class CrosSettings;
15 namespace system { 17 namespace system {
16 class StatisticsProvider; 18 class StatisticsProvider;
17 } 19 }
18 } 20 }
19 21
20 namespace enterprise_management { 22 namespace enterprise_management {
21 class DeviceStatusReportRequest; 23 class DeviceStatusReportRequest;
22 } 24 }
23 25
24 class PrefService; 26 class PrefService;
25 27
26 namespace policy { 28 namespace policy {
27 29
28 // Collects and summarizes the status of an enterprised-managed ChromeOS device. 30 // Collects and summarizes the status of an enterprised-managed ChromeOS device.
29 class DeviceStatusCollector { 31 class DeviceStatusCollector : public content::NotificationObserver {
30 public: 32 public:
31 DeviceStatusCollector(PrefService* local_state, 33 DeviceStatusCollector(PrefService* local_state,
32 chromeos::system::StatisticsProvider* provider); 34 chromeos::system::StatisticsProvider* provider);
33 virtual ~DeviceStatusCollector(); 35 virtual ~DeviceStatusCollector();
34 36
35 void GetStatus(enterprise_management::DeviceStatusReportRequest* request); 37 void GetStatus(enterprise_management::DeviceStatusReportRequest* request);
36 38
37 static void RegisterPrefs(PrefService* local_state); 39 static void RegisterPrefs(PrefService* local_state);
38 40
39 // How often, in seconds, to poll to see if the user is idle. 41 // How often, in seconds, to poll to see if the user is idle.
(...skipping 14 matching lines...) Expand all
54 56
55 private: 57 private:
56 void AddActivePeriod(base::Time start, base::Time end); 58 void AddActivePeriod(base::Time start, base::Time end);
57 59
58 // Callbacks from chromeos::VersionLoader. 60 // Callbacks from chromeos::VersionLoader.
59 void OnOSVersion(chromeos::VersionLoader::Handle handle, 61 void OnOSVersion(chromeos::VersionLoader::Handle handle,
60 std::string version); 62 std::string version);
61 void OnOSFirmware(chromeos::VersionLoader::Handle handle, 63 void OnOSFirmware(chromeos::VersionLoader::Handle handle,
62 std::string version); 64 std::string version);
63 65
66 // Helpers for the various portions of the status.
67 void GetActivityTimes(
68 enterprise_management::DeviceStatusReportRequest* request);
69 void GetVersionInfo(
70 enterprise_management::DeviceStatusReportRequest* request);
71 void GetBootMode(
72 enterprise_management::DeviceStatusReportRequest* request);
73
74 // Update the cached values of the reporting settings.
75 void UpdateReportingSettings();
76
77 // content::NotificationObserver interface.
78 virtual void Observe(
79 int type,
80 const content::NotificationSource& source,
81 const content::NotificationDetails& details) OVERRIDE;
82
64 // How often to poll to see if the user is idle. 83 // How often to poll to see if the user is idle.
65 int poll_interval_seconds_; 84 int poll_interval_seconds_;
66 85
67 PrefService* local_state_; 86 PrefService* local_state_;
68 87
69 // The last time an idle state check was performed. 88 // The last time an idle state check was performed.
70 base::Time last_idle_check_; 89 base::Time last_idle_check_;
71 90
72 // The idle state the last time it was checked. 91 // The idle state the last time it was checked.
73 IdleState last_idle_state_; 92 IdleState last_idle_state_;
74 93
75 base::RepeatingTimer<DeviceStatusCollector> timer_; 94 base::RepeatingTimer<DeviceStatusCollector> timer_;
76 95
77 chromeos::VersionLoader version_loader_; 96 chromeos::VersionLoader version_loader_;
78 CancelableRequestConsumer consumer_; 97 CancelableRequestConsumer consumer_;
79 98
80 std::string os_version_; 99 std::string os_version_;
81 std::string firmware_version_; 100 std::string firmware_version_;
82 101
83 chromeos::system::StatisticsProvider* statistics_provider_; 102 chromeos::system::StatisticsProvider* statistics_provider_;
84 103
104 chromeos::CrosSettings* cros_settings_;
105
106 // Cached values of the reporting settings from the device policy.
107 bool report_version_info_;
108 bool report_activity_times_;
109 bool report_boot_mode_;
110
85 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); 111 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector);
86 }; 112 };
87 113
88 } // namespace policy 114 } // namespace policy
89 115
90 #endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ 116 #endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/device_policy_cache.cc ('k') | chrome/browser/policy/device_status_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698