| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // Returns the currently used owner key. | 125 // Returns the currently used owner key. |
| 126 scoped_refptr<ownership::PublicKey> GetPublicKey(); | 126 scoped_refptr<ownership::PublicKey> GetPublicKey(); |
| 127 | 127 |
| 128 // Returns the status generated by the last operation. | 128 // Returns the status generated by the last operation. |
| 129 Status status() { return store_status_; } | 129 Status status() { return store_status_; } |
| 130 | 130 |
| 131 // Triggers an attempt to pull the public half of the owner key from disk and | 131 // Triggers an attempt to pull the public half of the owner key from disk and |
| 132 // load the device settings. | 132 // load the device settings. |
| 133 void Load(); | 133 void Load(); |
| 134 | 134 |
| 135 // Synchronously pulls the public key and loads the device settings. |
| 136 void LoadImmediately(); |
| 137 |
| 135 // Stores a policy blob to session_manager. The result of the operation is | 138 // Stores a policy blob to session_manager. The result of the operation is |
| 136 // reported through |callback|. If successful, the updated device settings are | 139 // reported through |callback|. If successful, the updated device settings are |
| 137 // present in policy_data() and device_settings() when the callback runs. | 140 // present in policy_data() and device_settings() when the callback runs. |
| 138 void Store(std::unique_ptr<enterprise_management::PolicyFetchResponse> policy, | 141 void Store(std::unique_ptr<enterprise_management::PolicyFetchResponse> policy, |
| 139 const base::Closure& callback); | 142 const base::Closure& callback); |
| 140 | 143 |
| 141 // Returns the ownership status. May return OWNERSHIP_UNKNOWN if the disk | 144 // Returns the ownership status. May return OWNERSHIP_UNKNOWN if the disk |
| 142 // hasn't been checked yet. | 145 // hasn't been checked yet. |
| 143 OwnershipStatus GetOwnershipStatus(); | 146 OwnershipStatus GetOwnershipStatus(); |
| 144 | 147 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 void EnqueueLoad(bool request_key_load); | 192 void EnqueueLoad(bool request_key_load); |
| 190 | 193 |
| 191 // Makes sure there's a reload operation so changes to the settings (and key, | 194 // Makes sure there's a reload operation so changes to the settings (and key, |
| 192 // in case |request_key_load| is set) are getting picked up. | 195 // in case |request_key_load| is set) are getting picked up. |
| 193 void EnsureReload(bool request_key_load); | 196 void EnsureReload(bool request_key_load); |
| 194 | 197 |
| 195 // Runs the next pending operation. | 198 // Runs the next pending operation. |
| 196 void StartNextOperation(); | 199 void StartNextOperation(); |
| 197 | 200 |
| 198 // Updates status, policy data and owner key from a finished operation. | 201 // Updates status, policy data and owner key from a finished operation. |
| 199 // Starts the next pending operation if available. | |
| 200 void HandleCompletedOperation(const base::Closure& callback, | 202 void HandleCompletedOperation(const base::Closure& callback, |
| 201 SessionManagerOperation* operation, | 203 SessionManagerOperation* operation, |
| 202 Status status); | 204 Status status); |
| 203 | 205 |
| 206 // Same as HandleCompletedOperation(), but also starts the next pending |
| 207 // operation if available. |
| 208 void HandleCompletedAsyncOperation(const base::Closure& callback, |
| 209 SessionManagerOperation* operation, |
| 210 Status status); |
| 211 |
| 204 // Updates status and invokes the callback immediately. | 212 // Updates status and invokes the callback immediately. |
| 205 void HandleError(Status status, const base::Closure& callback); | 213 void HandleError(Status status, const base::Closure& callback); |
| 206 | 214 |
| 207 // Run OwnershipStatusChanged() for observers and push | 215 // Run OwnershipStatusChanged() for observers and push |
| 208 // NOTIFICATION_OWNERSHIP_STATUS_CHANGED to NotificationService. | 216 // NOTIFICATION_OWNERSHIP_STATUS_CHANGED to NotificationService. |
| 209 void NotifyOwnershipStatusChanged() const; | 217 void NotifyOwnershipStatusChanged() const; |
| 210 | 218 |
| 211 // Run DeviceSettingsUpdated() for observers. | 219 // Run DeviceSettingsUpdated() for observers. |
| 212 void NotifyDeviceSettingsUpdated() const; | 220 void NotifyDeviceSettingsUpdated() const; |
| 213 | 221 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 ScopedTestDeviceSettingsService(); | 262 ScopedTestDeviceSettingsService(); |
| 255 ~ScopedTestDeviceSettingsService(); | 263 ~ScopedTestDeviceSettingsService(); |
| 256 | 264 |
| 257 private: | 265 private: |
| 258 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); | 266 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); |
| 259 }; | 267 }; |
| 260 | 268 |
| 261 } // namespace chromeos | 269 } // namespace chromeos |
| 262 | 270 |
| 263 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 271 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
| OLD | NEW |