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

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

Issue 2714493002: Load DeviceLocalAccount policy and DeviceSettings immediately on restore after Chrome crash. (Closed)
Patch Set: add flag to correctly process LoadImmediately() call Created 3 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_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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 std::unique_ptr<enterprise_management::PolicyData> policy_data_; 233 std::unique_ptr<enterprise_management::PolicyData> policy_data_;
231 std::unique_ptr<enterprise_management::ChromeDeviceSettingsProto> 234 std::unique_ptr<enterprise_management::ChromeDeviceSettingsProto>
232 device_settings_; 235 device_settings_;
233 236
234 policy::DeviceMode device_mode_ = policy::DEVICE_MODE_PENDING; 237 policy::DeviceMode device_mode_ = policy::DEVICE_MODE_PENDING;
235 238
236 // The queue of pending operations. The first operation on the queue is 239 // The queue of pending operations. The first operation on the queue is
237 // currently active; it gets removed and destroyed once it completes. 240 // currently active; it gets removed and destroyed once it completes.
238 std::deque<linked_ptr<SessionManagerOperation>> pending_operations_; 241 std::deque<linked_ptr<SessionManagerOperation>> pending_operations_;
239 242
243 // Flags whether current load operation was started synchronously, not from
244 // queue of pending operations.
245 bool loading_immediately_ = false;
246
240 base::ObserverList<Observer> observers_; 247 base::ObserverList<Observer> observers_;
241 248
242 // For recoverable load errors how many retries are left before we give up. 249 // For recoverable load errors how many retries are left before we give up.
243 int load_retries_left_; 250 int load_retries_left_;
244 251
245 base::WeakPtrFactory<DeviceSettingsService> weak_factory_; 252 base::WeakPtrFactory<DeviceSettingsService> weak_factory_;
246 253
247 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService); 254 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsService);
248 }; 255 };
249 256
250 // Helper class for tests. Initializes the DeviceSettingsService singleton on 257 // Helper class for tests. Initializes the DeviceSettingsService singleton on
251 // construction and tears it down again on destruction. 258 // construction and tears it down again on destruction.
252 class ScopedTestDeviceSettingsService { 259 class ScopedTestDeviceSettingsService {
253 public: 260 public:
254 ScopedTestDeviceSettingsService(); 261 ScopedTestDeviceSettingsService();
255 ~ScopedTestDeviceSettingsService(); 262 ~ScopedTestDeviceSettingsService();
256 263
257 private: 264 private:
258 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService); 265 DISALLOW_COPY_AND_ASSIGN(ScopedTestDeviceSettingsService);
259 }; 266 };
260 267
261 } // namespace chromeos 268 } // namespace chromeos
262 269
263 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_ 270 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698