Index: chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h |
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h |
index e3eaa0a559812e7c4d64152b43472df654513c90..364072b92c6fb8af4e3a567747891e151d33acc1 100644 |
--- a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h |
+++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h |
@@ -18,6 +18,7 @@ |
#include "components/keyed_service/core/keyed_service.h" |
#include "components/ownership/owner_key_util.h" |
#include "components/ownership/owner_settings_service.h" |
+#include "components/policy/core/common/cloud/cloud_policy_constants.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
@@ -41,6 +42,17 @@ class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService, |
public SessionManagerClient::Observer, |
public DeviceSettingsService::Observer { |
public: |
+ typedef base::Callback<void(bool success)> OnManagementSettingsSetCallback; |
+ |
+ struct ManagementSettings { |
+ ManagementSettings(); |
+ ~ManagementSettings(); |
+ |
+ policy::ManagementMode management_mode; |
+ std::string request_token; |
+ std::string device_id; |
+ }; |
+ |
virtual ~OwnerSettingsServiceChromeOS(); |
void OnTPMTokenReady(bool tpm_token_enabled); |
@@ -65,6 +77,10 @@ class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService, |
virtual void DeviceSettingsUpdated() override; |
virtual void OnDeviceSettingsServiceShutdown() override; |
+ // Sets the management related settings. |
+ void SetManagementSettings(const ManagementSettings& settings, |
+ const OnManagementSettingsSetCallback& callback); |
+ |
// Checks if the user is the device owner, without the user profile having to |
// been initialized. Should be used only if login state is in safe mode. |
static void IsOwnerForSafeModeAsync( |
@@ -86,7 +102,8 @@ class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService, |
enterprise_management::ChromeDeviceSettingsProto& settings); |
bool has_pending_changes() const { |
- return !pending_changes_.empty() || tentative_settings_.get(); |
+ return !pending_changes_.empty() || tentative_settings_.get() || |
+ has_pending_management_settings_; |
} |
private: |
@@ -141,6 +158,17 @@ class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService, |
// A set of pending changes to device settings. |
base::ScopedPtrHashMap<std::string, base::Value> pending_changes_; |
+ // True if there're pending changes to management settings. |
+ bool has_pending_management_settings_; |
+ |
+ // A set of pending changes to management settings. |
+ ManagementSettings pending_management_settings_; |
+ |
+ // A set of callbacks that need to be run after management settings |
+ // are set and policy is stored. |
+ std::vector<OnManagementSettingsSetCallback> |
+ pending_management_settings_callbacks_; |
+ |
// A protobuf containing pending changes to device settings. |
scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> |
tentative_settings_; |