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

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h

Issue 845313008: Refactored device status uploading out of policy fetch infrastructure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback. Created 5 years, 10 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
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_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 } 29 }
30 30
31 class PrefRegistrySimple; 31 class PrefRegistrySimple;
32 class PrefService; 32 class PrefService;
33 33
34 namespace policy { 34 namespace policy {
35 35
36 class DeviceCloudPolicyStoreChromeOS; 36 class DeviceCloudPolicyStoreChromeOS;
37 class EnterpriseInstallAttributes; 37 class EnterpriseInstallAttributes;
38 class StatusUploader;
38 39
39 // CloudPolicyManager specialization for device policy on Chrome OS. 40 // CloudPolicyManager specialization for device policy on Chrome OS.
40 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager { 41 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager {
41 public: 42 public:
42 class Observer { 43 class Observer {
43 public: 44 public:
44 // Invoked when the device cloud policy manager connects. 45 // Invoked when the device cloud policy manager connects.
45 virtual void OnDeviceCloudPolicyManagerConnected() = 0; 46 virtual void OnDeviceCloudPolicyManagerConnected() = 0;
46 // Invoked when the device cloud policy manager disconnects. 47 // Invoked when the device cloud policy manager disconnects.
47 virtual void OnDeviceCloudPolicyManagerDisconnected() = 0; 48 virtual void OnDeviceCloudPolicyManagerDisconnected() = 0;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // parameter indicating the result when done. 96 // parameter indicating the result when done.
96 virtual void Unregister(const UnregisterCallback& callback); 97 virtual void Unregister(const UnregisterCallback& callback);
97 98
98 // Disconnects the manager. 99 // Disconnects the manager.
99 virtual void Disconnect(); 100 virtual void Disconnect();
100 101
101 DeviceCloudPolicyStoreChromeOS* device_store() { 102 DeviceCloudPolicyStoreChromeOS* device_store() {
102 return device_store_.get(); 103 return device_store_.get();
103 } 104 }
104 105
106 bool HasStatusUploaderForTest() { return status_uploader_; }
107
105 private: 108 private:
106 // Saves the state keys received from |session_manager_client_|. 109 // Saves the state keys received from |session_manager_client_|.
107 void OnStateKeysUpdated(); 110 void OnStateKeysUpdated();
108 111
109 // Initializes requisition settings at OOBE with values from VPD. 112 // Initializes requisition settings at OOBE with values from VPD.
110 void InitializeRequisition(); 113 void InitializeRequisition();
111 114
112 void NotifyConnected(); 115 void NotifyConnected();
113 void NotifyDisconnected(); 116 void NotifyDisconnected();
114 117
118 // Factory function to create the StatusUploader.
119 void CreateStatusUploader();
120
115 // Points to the same object as the base CloudPolicyManager::store(), but with 121 // Points to the same object as the base CloudPolicyManager::store(), but with
116 // actual device policy specific type. 122 // actual device policy specific type.
117 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_store_; 123 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_store_;
118 ServerBackedStateKeysBroker* state_keys_broker_; 124 ServerBackedStateKeysBroker* state_keys_broker_;
119 125
126 // Helper object that handles updating the server with our current device
127 // state.
128 scoped_ptr<StatusUploader> status_uploader_;
129
130 // The TaskRunner used to do device status uploads.
131 scoped_refptr<base::SequencedTaskRunner> task_runner_;
132
120 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; 133 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_;
121 134
122 // PrefService instance to read the policy refresh rate from. 135 // PrefService instance to read the policy refresh rate from.
123 PrefService* local_state_; 136 PrefService* local_state_;
124 137
125 scoped_ptr<chromeos::attestation::AttestationPolicyObserver> 138 scoped_ptr<chromeos::attestation::AttestationPolicyObserver>
126 attestation_policy_observer_; 139 attestation_policy_observer_;
127 140
128 ObserverList<Observer, true> observers_; 141 ObserverList<Observer, true> observers_;
129 142
130 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); 143 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS);
131 }; 144 };
132 145
133 } // namespace policy 146 } // namespace policy
134 147
135 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H _ 148 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698