OLD | NEW |
---|---|
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_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 | 124 |
125 // Returns the status generated by the last operation. | 125 // Returns the status generated by the last operation. |
126 Status status() { | 126 Status status() { |
127 return store_status_; | 127 return store_status_; |
128 } | 128 } |
129 | 129 |
130 // Triggers an attempt to pull the public half of the owner key from disk and | 130 // Triggers an attempt to pull the public half of the owner key from disk and |
131 // load the device settings. | 131 // load the device settings. |
132 void Load(); | 132 void Load(); |
133 | 133 |
134 // Sets the management related settings in PolicyData. | |
135 // | |
136 // TODO (ygorshenin@, crbug.com/230018): move this to the | |
137 // OwnerSettingsService. | |
138 void SetManagementSettings( | |
139 enterprise_management::PolicyData::ManagementMode management_mode, | |
140 const std::string& request_token, | |
141 const std::string& device_id, | |
142 const base::Closure& callback); | |
143 | |
144 // Stores a policy blob to session_manager. The result of the operation is | 134 // Stores a policy blob to session_manager. The result of the operation is |
145 // reported through |callback|. If successful, the updated device settings are | 135 // reported through |callback|. If successful, the updated device settings are |
146 // present in policy_data() and device_settings() when the callback runs. | 136 // present in policy_data() and device_settings() when the callback runs. |
147 void Store(scoped_ptr<enterprise_management::PolicyFetchResponse> policy, | 137 void Store(scoped_ptr<enterprise_management::PolicyFetchResponse> policy, |
148 const base::Closure& callback); | 138 const base::Closure& callback); |
149 | 139 |
150 // Returns the ownership status. May return OWNERSHIP_UNKNOWN if the disk | 140 // Returns the ownership status. May return OWNERSHIP_UNKNOWN if the disk |
151 // hasn't been checked yet. | 141 // hasn't been checked yet. |
152 OwnershipStatus GetOwnershipStatus(); | 142 OwnershipStatus GetOwnershipStatus(); |
153 | 143 |
154 // Determines the ownership status and reports the result to |callback|. This | 144 // Determines the ownership status and reports the result to |callback|. This |
155 // is guaranteed to never return OWNERSHIP_UNKNOWN. | 145 // is guaranteed to never return OWNERSHIP_UNKNOWN. |
156 void GetOwnershipStatusAsync(const OwnershipStatusCallback& callback); | 146 void GetOwnershipStatusAsync(const OwnershipStatusCallback& callback); |
157 | 147 |
158 // Checks whether we have the private owner key. | 148 // Checks whether we have the private owner key. |
149 // | |
150 // DEPRECATED (ygorshenin@, crbug.com/433840): this method should | |
151 // not be used since private key is a profile-specific resource and | |
152 // should be checked and used in a profile-aware manner, through | |
153 // OwnerSettingsService. | |
159 bool HasPrivateOwnerKey(); | 154 bool HasPrivateOwnerKey(); |
160 | 155 |
161 // Sets the identity of the user that's interacting with the service. This is | 156 // Sets the identity of the user that's interacting with the service. This is |
162 // relevant only for writing settings through SignAndStore(). | 157 // relevant only for writing settings through SignAndStore(). |
158 // | |
159 // TODO (ygorshenin@, crbug.com/433840): get rid of the method when | |
160 // write path for device settings will be removed from | |
161 // DeviceSettingsProvider and all existing clients will be switched | |
162 // to OwnerSettingsServiceCHromeOS. | |
Mattias Nissler (ping if slow)
2014/12/03 09:07:54
nit: lower-case H
ygorshenin1
2014/12/03 15:54:05
Done.
| |
163 void InitOwner(const std::string& username, | 163 void InitOwner(const std::string& username, |
164 const base::WeakPtr<ownership::OwnerSettingsService>& | 164 const base::WeakPtr<ownership::OwnerSettingsService>& |
165 owner_settings_service); | 165 owner_settings_service); |
166 | 166 |
167 const std::string& GetUsername() const; | 167 const std::string& GetUsername() const; |
168 | 168 |
169 ownership::OwnerSettingsService* GetOwnerSettingsService() const; | 169 ownership::OwnerSettingsService* GetOwnerSettingsService() const; |
170 | 170 |
171 // Adds an observer. | 171 // Adds an observer. |
172 void AddObserver(Observer* observer); | 172 void AddObserver(Observer* observer); |
173 // Removes an observer. | 173 // Removes an observer. |
174 void RemoveObserver(Observer* observer); | 174 void RemoveObserver(Observer* observer); |
175 | 175 |
176 // SessionManagerClient::Observer: | 176 // SessionManagerClient::Observer: |
177 virtual void OwnerKeySet(bool success) override; | 177 virtual void OwnerKeySet(bool success) override; |
178 virtual void PropertyChangeComplete(bool success) override; | 178 virtual void PropertyChangeComplete(bool success) override; |
179 | 179 |
180 private: | 180 private: |
181 friend class OwnerSettingsServiceChromeOS; | 181 friend class OwnerSettingsServiceChromeOS; |
182 | 182 |
183 // Enqueues a new operation. Takes ownership of |operation| and starts it | 183 // Enqueues a new operation. Takes ownership of |operation| and starts it |
184 // right away if there is no active operation currently. | 184 // right away if there is no active operation currently. |
185 void Enqueue(const linked_ptr<SessionManagerOperation>& operation); | 185 void Enqueue(const linked_ptr<SessionManagerOperation>& operation); |
186 | 186 |
187 // Enqueues a load operation. | 187 // Enqueues a load operation. |
188 void EnqueueLoad(bool force_key_load); | 188 void EnqueueLoad(bool force_key_load); |
189 | 189 |
190 // Enqueues a sign and store operation. | |
191 // | |
192 // TODO (ygorshenin@, crbug.com/433840): extract SetManagementSettings() out | |
193 // of DeviceSettingsService and get rid of the method. | |
194 void EnqueueSignAndStore(scoped_ptr<enterprise_management::PolicyData> policy, | |
195 const base::Closure& callback); | |
196 | |
197 // Makes sure there's a reload operation so changes to the settings (and key, | 190 // Makes sure there's a reload operation so changes to the settings (and key, |
198 // in case force_key_load is set) are getting picked up. | 191 // in case force_key_load is set) are getting picked up. |
199 void EnsureReload(bool force_key_load); | 192 void EnsureReload(bool force_key_load); |
200 | 193 |
201 // Runs the next pending operation. | 194 // Runs the next pending operation. |
202 void StartNextOperation(); | 195 void StartNextOperation(); |
203 | 196 |
204 // Updates status, policy data and owner key from a finished operation. | 197 // Updates status, policy data and owner key from a finished operation. |
205 // Starts the next pending operation if available. | 198 // Starts the next pending operation if available. |
206 void HandleCompletedOperation(const base::Closure& callback, | 199 void HandleCompletedOperation(const base::Closure& callback, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 ScopedTestDeviceSettingsService(); | 238 ScopedTestDeviceSettingsService(); |
246 ~ScopedTestDeviceSettingsService(); | 239 ~ScopedTestDeviceSettingsService(); |
247 | 240 |
248 private: | 241 private: |
249 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); | 242 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); |
250 }; | 243 }; |
251 | 244 |
252 } // namespace chromeos | 245 } // namespace chromeos |
253 | 246 |
254 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 247 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
OLD | NEW |