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

Unified Diff: chrome/browser/chromeos/settings/device_settings_service.h

Issue 399613003: SignAndStore method is moved out from DeviceSettingsService to OwnerSettingsService. It's still cal… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deleted inclusion of dbus_thread_manager.h. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
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 391ba056e87ff8c3625d91eb9ba6fba2da10ac76..c895bafda665231efc010fa6b7bc7f78a02d9342 100644
--- a/chrome/browser/chromeos/settings/device_settings_service.h
+++ b/chrome/browser/chromeos/settings/device_settings_service.h
@@ -15,6 +15,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
+#include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
#include "chromeos/dbus/session_manager_client.h"
#include "components/policy/core/common/cloud/cloud_policy_validator.h"
#include "crypto/scoped_nss_types.h"
@@ -24,10 +25,6 @@ namespace crypto {
class RSAPrivateKey;
}
-namespace enterprise_management {
-class ChromeDeviceSettingsProto;
-}
-
namespace chromeos {
class OwnerKeyUtil;
@@ -103,6 +100,25 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
virtual bool AssembleAndSignPolicyAsync(
scoped_ptr<enterprise_management::PolicyData> policy,
const AssembleAndSignPolicyCallback& callback) = 0;
+
+ // Signs |settings| with the private half of the owner key and sends
+ // the resulting policy blob to session manager for storage. The
+ // result of the operation is reported through |callback|. If
+ // successful, the updated device settings are present in
+ // policy_data() and device_settings() when the callback runs.
+ virtual void SignAndStoreAsync(
+ scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> settings,
+ const base::Closure& callback) = 0;
+
+ // Sets the management related settings in PolicyData. Note that if
+ // |management_mode| is NOT_MANAGED, |request_token| and |device_id|
+ // should be empty strings. The result of the operation is reported
+ // through |callback|.
+ virtual void SetManagementSettingsAsync(
+ enterprise_management::PolicyData::ManagementMode management_mode,
+ const std::string& request_token,
+ const std::string& device_id,
+ const base::Closure& callback) = 0;
};
// Manage singleton instance.
@@ -124,6 +140,10 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
// and stops any pending operations.
void UnsetSessionManager();
+ SessionManagerClient* session_manager_client() const {
+ return session_manager_client_;
+ }
+
// Returns the currently active device settings. Returns NULL if the device
// settings have not been retrieved from session_manager yet.
const enterprise_management::PolicyData* policy_data() {
@@ -155,9 +175,6 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> new_settings,
const base::Closure& callback);
- // Sets the management related settings in PolicyData. Note that if
- // |management_mode| is NOT_MANAGED, |request_token| and |device_id| should be
- // empty strings.
void SetManagementSettings(
pastarmovj 2014/07/18 11:20:16 I think you should preserve at least the first sen
ygorshenin1 2014/07/18 11:48:47 Done.
enterprise_management::PolicyData::ManagementMode management_mode,
const std::string& request_token,
@@ -197,6 +214,8 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
virtual void PropertyChangeComplete(bool success) OVERRIDE;
private:
+ friend class OwnerSettingsService;
+
// Enqueues a new operation. Takes ownership of |operation| and starts it
// right away if there is no active operation currently.
void Enqueue(SessionManagerOperation* operation);
@@ -204,9 +223,6 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
// Enqueues a load operation.
void EnqueueLoad(bool force_key_load);
- 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);
@@ -223,18 +239,18 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
// Updates status and invokes the callback immediately.
void HandleError(Status status, const base::Closure& callback);
- // Assembles PolicyData based on |settings| and the current |policy_data_|
- // and |username_|.
- scoped_ptr<enterprise_management::PolicyData> AssemblePolicy(
- const enterprise_management::ChromeDeviceSettingsProto& settings) const;
+ // Called by OwnerSettingsService when sign-and-store operation completes.
+ void OnSignAndStoreOperationCompleted(Status status);
- // Returns the current management mode.
- enterprise_management::PolicyData::ManagementMode GetManagementMode() const;
+ void set_policy_data(
+ scoped_ptr<enterprise_management::PolicyData> policy_data) {
+ policy_data_ = policy_data.Pass();
+ }
- // Returns true if it is okay to transfer from the current mode to the new
- // mode. This function should be called in SetManagementMode().
- bool CheckManagementModeTransition(
- enterprise_management::PolicyData::ManagementMode new_mode) const;
+ void set_device_settings(scoped_ptr<
+ enterprise_management::ChromeDeviceSettingsProto> device_settings) {
+ device_settings_ = device_settings.Pass();
+ }
SessionManagerClient* session_manager_client_;
scoped_refptr<OwnerKeyUtil> owner_key_util_;

Powered by Google App Engine
This is Rietveld 408576698