Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 OWNERSHIP_UNKNOWN = 0, | 52 OWNERSHIP_UNKNOWN = 0, |
| 53 // Not yet owned. | 53 // Not yet owned. |
| 54 OWNERSHIP_NONE, | 54 OWNERSHIP_NONE, |
| 55 // Either consumer ownership, cloud management or Active Directory | 55 // Either consumer ownership, cloud management or Active Directory |
| 56 // management. | 56 // management. |
| 57 OWNERSHIP_TAKEN | 57 OWNERSHIP_TAKEN |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 typedef base::Callback<void(OwnershipStatus)> OwnershipStatusCallback; | 60 typedef base::Callback<void(OwnershipStatus)> OwnershipStatusCallback; |
| 61 | 61 |
| 62 // Status codes for Store(). | 62 // Status codes for Load() and Store(). |
|
emaxx
2017/06/01 18:51:17
Should we then rename all enum items to change the
Thiemo Nagel
2017/06/02 09:30:53
I agree that it's a bit confusing. Maybe STORE_ i
| |
| 63 enum Status { | 63 enum Status { |
| 64 STORE_SUCCESS, | 64 STORE_SUCCESS, |
| 65 STORE_KEY_UNAVAILABLE, // Owner key not yet configured. | 65 STORE_KEY_UNAVAILABLE, // Owner key not yet configured. |
| 66 STORE_POLICY_ERROR, // Failure constructing the settings blob. | 66 STORE_OPERATION_FAILED, // IPC to session_manager daemon failed. |
| 67 STORE_OPERATION_FAILED, // IPC to session_manager daemon failed. | 67 STORE_NO_POLICY, // No settings blob present. |
| 68 STORE_NO_POLICY, // No settings blob present. | 68 STORE_INVALID_POLICY, // Invalid settings blob (proto parse failed). |
| 69 STORE_INVALID_POLICY, // Invalid settings blob. | 69 STORE_VALIDATION_ERROR, // Policy validation failure. |
| 70 STORE_VALIDATION_ERROR, // Unrecoverable policy validation failure. | |
| 71 STORE_TEMP_VALIDATION_ERROR, // Temporary policy validation failure. | |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 // Observer interface. | 72 // Observer interface. |
| 75 class Observer { | 73 class Observer { |
| 76 public: | 74 public: |
| 77 virtual ~Observer(); | 75 virtual ~Observer(); |
| 78 | 76 |
| 79 // Indicates device ownership status changes. This is triggered upon every | 77 // Indicates device ownership status changes. This is triggered upon every |
| 80 // browser start since the transition from uninitialized (OWNERSHIP_UNKNOWN) | 78 // browser start since the transition from uninitialized (OWNERSHIP_UNKNOWN) |
| 81 // to initialized (either of OWNERSHIP_{NONE,TAKEN}) also counts as an | 79 // to initialized (either of OWNERSHIP_{NONE,TAKEN}) also counts as an |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 device_settings_; | 244 device_settings_; |
| 247 | 245 |
| 248 policy::DeviceMode device_mode_ = policy::DEVICE_MODE_PENDING; | 246 policy::DeviceMode device_mode_ = policy::DEVICE_MODE_PENDING; |
| 249 | 247 |
| 250 // The queue of pending operations. The first operation on the queue is | 248 // The queue of pending operations. The first operation on the queue is |
| 251 // currently active; it gets removed and destroyed once it completes. | 249 // currently active; it gets removed and destroyed once it completes. |
| 252 std::deque<linked_ptr<SessionManagerOperation>> pending_operations_; | 250 std::deque<linked_ptr<SessionManagerOperation>> pending_operations_; |
| 253 | 251 |
| 254 base::ObserverList<Observer> observers_; | 252 base::ObserverList<Observer> observers_; |
| 255 | 253 |
| 256 // For recoverable load errors how many retries are left before we give up. | |
| 257 int load_retries_left_; | |
| 258 | |
| 259 // Whether the device will be establishing consumer ownership. | 254 // Whether the device will be establishing consumer ownership. |
| 260 bool will_establish_consumer_ownership_ = false; | 255 bool will_establish_consumer_ownership_ = false; |
| 261 | 256 |
| 262 base::WeakPtrFactory<DeviceSettingsService> weak_factory_; | 257 base::WeakPtrFactory<DeviceSettingsService> weak_factory_{this}; |
| 263 | 258 |
| 264 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService); | 259 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService); |
| 265 }; | 260 }; |
| 266 | 261 |
| 267 // Helper class for tests. Initializes the DeviceSettingsService singleton on | 262 // Helper class for tests. Initializes the DeviceSettingsService singleton on |
| 268 // construction and tears it down again on destruction. | 263 // construction and tears it down again on destruction. |
| 269 class ScopedTestDeviceSettingsService { | 264 class ScopedTestDeviceSettingsService { |
| 270 public: | 265 public: |
| 271 ScopedTestDeviceSettingsService(); | 266 ScopedTestDeviceSettingsService(); |
| 272 ~ScopedTestDeviceSettingsService(); | 267 ~ScopedTestDeviceSettingsService(); |
| 273 | 268 |
| 274 private: | 269 private: |
| 275 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); | 270 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); |
| 276 }; | 271 }; |
| 277 | 272 |
| 278 } // namespace chromeos | 273 } // namespace chromeos |
| 279 | 274 |
| 280 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ | 275 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ |
| OLD | NEW |