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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_service.h

Issue 2798343003: Merge "cros: Fix flaky owner detection" (Closed)
Patch Set: Created 3 years, 8 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_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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // DeviceSettingsProvider and all existing clients will be switched 165 // DeviceSettingsProvider and all existing clients will be switched
166 // to OwnerSettingsServiceChromeOS. 166 // to OwnerSettingsServiceChromeOS.
167 void InitOwner(const std::string& username, 167 void InitOwner(const std::string& username,
168 const base::WeakPtr<ownership::OwnerSettingsService>& 168 const base::WeakPtr<ownership::OwnerSettingsService>&
169 owner_settings_service); 169 owner_settings_service);
170 170
171 const std::string& GetUsername() const; 171 const std::string& GetUsername() const;
172 172
173 ownership::OwnerSettingsService* GetOwnerSettingsService() const; 173 ownership::OwnerSettingsService* GetOwnerSettingsService() const;
174 174
175 // Mark that the device will establish consumer ownership. If the flag is set
176 // and ownership is not taken, policy reload will be deferred until InitOwner
177 // is called. So that the ownership status is flipped after the private part
178 // of owner is fully loaded.
179 void MarkWillEstablishConsumerOwnership();
180
175 // Adds an observer. 181 // Adds an observer.
176 void AddObserver(Observer* observer); 182 void AddObserver(Observer* observer);
177 // Removes an observer. 183 // Removes an observer.
178 void RemoveObserver(Observer* observer); 184 void RemoveObserver(Observer* observer);
179 185
180 // SessionManagerClient::Observer: 186 // SessionManagerClient::Observer:
181 void OwnerKeySet(bool success) override; 187 void OwnerKeySet(bool success) override;
182 void PropertyChangeComplete(bool success) override; 188 void PropertyChangeComplete(bool success) override;
183 189
184 private: 190 private:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 249
244 // The queue of pending operations. The first operation on the queue is 250 // The queue of pending operations. The first operation on the queue is
245 // currently active; it gets removed and destroyed once it completes. 251 // currently active; it gets removed and destroyed once it completes.
246 std::deque<linked_ptr<SessionManagerOperation>> pending_operations_; 252 std::deque<linked_ptr<SessionManagerOperation>> pending_operations_;
247 253
248 base::ObserverList<Observer> observers_; 254 base::ObserverList<Observer> observers_;
249 255
250 // For recoverable load errors how many retries are left before we give up. 256 // For recoverable load errors how many retries are left before we give up.
251 int load_retries_left_; 257 int load_retries_left_;
252 258
259 // Whether the device will be establishing consumer ownership.
260 bool will_establish_consumer_ownership_ = false;
261
253 base::WeakPtrFactory<DeviceSettingsService> weak_factory_; 262 base::WeakPtrFactory<DeviceSettingsService> weak_factory_;
254 263
255 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService); 264 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService);
256 }; 265 };
257 266
258 // Helper class for tests. Initializes the DeviceSettingsService singleton on 267 // Helper class for tests. Initializes the DeviceSettingsService singleton on
259 // construction and tears it down again on destruction. 268 // construction and tears it down again on destruction.
260 class ScopedTestDeviceSettingsService { 269 class ScopedTestDeviceSettingsService {
261 public: 270 public:
262 ScopedTestDeviceSettingsService(); 271 ScopedTestDeviceSettingsService();
263 ~ScopedTestDeviceSettingsService(); 272 ~ScopedTestDeviceSettingsService();
264 273
265 private: 274 private:
266 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); 275 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService);
267 }; 276 };
268 277
269 } // namespace chromeos 278 } // namespace chromeos
270 279
271 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ 280 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698