Index: chrome/browser/chromeos/settings/device_settings_service.h |
diff --git a/chrome/browser/chromeos/settings/device_settings_service.h b/chrome/browser/chromeos/settings/device_settings_service.h |
index 6f2ebdf8b70652a73f620504a296a8471f16bbce..a4a499f95e281478bb1dabbd25624cf06db01fa1 100644 |
--- a/chrome/browser/chromeos/settings/device_settings_service.h |
+++ b/chrome/browser/chromeos/settings/device_settings_service.h |
@@ -12,6 +12,7 @@ |
#include "base/basictypes.h" |
#include "base/callback.h" |
#include "base/compiler_specific.h" |
+#include "base/memory/linked_ptr.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/observer_list.h" |
@@ -89,6 +90,19 @@ class DeviceSettingsService : public SessionManagerClient::Observer { |
static void Shutdown(); |
static DeviceSettingsService* Get(); |
+ // Updates device |settings|. |
+ static void UpdateDeviceSettings( |
+ const std::string& path, |
+ const base::Value& value, |
+ enterprise_management::ChromeDeviceSettingsProto& settings); |
+ |
+ // Assembles PolicyData based on |settings|, |policy_data| and |
+ // |user_id|. |
+ static scoped_ptr<enterprise_management::PolicyData> AssemblePolicy( |
+ const std::string& user_id, |
+ const enterprise_management::PolicyData* policy_data, |
+ const enterprise_management::ChromeDeviceSettingsProto* settings); |
+ |
// Creates a device settings service instance. This is meant for unit tests, |
// production code uses the singleton returned by Get() above. |
DeviceSettingsService(); |
@@ -174,6 +188,12 @@ class DeviceSettingsService : public SessionManagerClient::Observer { |
// Removes an observer. |
void RemoveObserver(Observer* observer); |
+ // Returns true if there is a pending session manager operation. |
+ bool HasPendingOperations() const; |
+ |
+ // Returns false when it's not possible to enable/disable processing loop. |
+ bool EnableProcessingLoop(bool enabled); |
+ |
// SessionManagerClient::Observer: |
virtual void OwnerKeySet(bool success) override; |
virtual void PropertyChangeComplete(bool success) override; |
@@ -183,11 +203,15 @@ class DeviceSettingsService : public SessionManagerClient::Observer { |
// Enqueues a new operation. Takes ownership of |operation| and starts it |
// right away if there is no active operation currently. |
- void Enqueue(SessionManagerOperation* operation); |
+ void Enqueue(const linked_ptr<SessionManagerOperation>& operation); |
// Enqueues a load operation. |
void EnqueueLoad(bool force_key_load); |
+ // Enqueues a sign and store operation. |
+ void EnqueueSignAndStore(scoped_ptr<enterprise_management::PolicyData> policy, |
+ const base::Closure& callback); |
+ |
// Makes sure there's a reload operation so changes to the settings (and key, |
// in case force_key_load is set) are getting picked up. |
void EnsureReload(bool force_key_load); |
@@ -204,19 +228,6 @@ class DeviceSettingsService : public SessionManagerClient::Observer { |
// Updates status and invokes the callback immediately. |
void HandleError(Status status, const base::Closure& callback); |
- // Called by OwnerSettingsService when sign-and-store operation completes. |
- void OnSignAndStoreOperationCompleted(Status status); |
- |
- void set_policy_data( |
- scoped_ptr<enterprise_management::PolicyData> policy_data) { |
- policy_data_ = policy_data.Pass(); |
- } |
- |
- void set_device_settings(scoped_ptr< |
- enterprise_management::ChromeDeviceSettingsProto> device_settings) { |
- device_settings_ = device_settings.Pass(); |
- } |
- |
SessionManagerClient* session_manager_client_; |
scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_; |
@@ -233,9 +244,12 @@ class DeviceSettingsService : public SessionManagerClient::Observer { |
// The queue of pending operations. The first operation on the queue is |
// currently active; it gets removed and destroyed once it completes. |
- std::deque<SessionManagerOperation*> pending_operations_; |
+ std::deque<linked_ptr<SessionManagerOperation>> pending_operations_; |
+ |
+ // When true, session manager operations are not processed. |
+ bool processing_loop_enabled_; |
- ObserverList<Observer, true> observers_; |
+ ObserverList<Observer> observers_; |
// For recoverable load errors how many retries are left before we give up. |
int load_retries_left_; |