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

Unified Diff: chrome/browser/chromeos/ownership/owner_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: Fix. 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/ownership/owner_settings_service.h
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service.h b/chrome/browser/chromeos/ownership/owner_settings_service.h
index b6b507b0a5aab57483690c87f41d5f55b6f52e5c..06313725faf3fa6f965f3617c40b3ab79fc72083 100644
--- a/chrome/browser/chromeos/ownership/owner_settings_service.h
+++ b/chrome/browser/chromeos/ownership/owner_settings_service.h
@@ -5,8 +5,10 @@
#ifndef CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_H_
#define CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_H_
+#include <deque>
#include <vector>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
@@ -22,6 +24,8 @@ class Profile;
namespace chromeos {
+class SessionManagerOperation;
+
// This class reloads owner key from profile NSS slots.
//
// TODO (ygorshenin@): move write path for device settings here
@@ -43,6 +47,14 @@ class OwnerSettingsService : public DeviceSettingsService::PrivateKeyDelegate,
virtual bool AssembleAndSignPolicyAsync(
scoped_ptr<enterprise_management::PolicyData> policy,
const AssembleAndSignPolicyCallback& callback) OVERRIDE;
+ virtual void SignAndStoreAsync(
+ scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> settings,
+ const base::Closure& callback) OVERRIDE;
+ virtual void SetManagementSettingsAsync(
+ enterprise_management::PolicyData::ManagementMode management_mode,
+ const std::string& request_token,
+ const std::string& device_id,
+ const base::Closure& callback) OVERRIDE;
// NotificationObserver implementation:
virtual void Observe(int type,
@@ -74,7 +86,24 @@ class OwnerSettingsService : public DeviceSettingsService::PrivateKeyDelegate,
void ReloadPrivateKey();
// Called when ReloadPrivateKey() completes it's work.
- void OnPrivateKeyLoaded(scoped_ptr<crypto::RSAPrivateKey> private_key);
+ void OnPrivateKeyLoaded(scoped_refptr<PublicKey> public_key,
+ scoped_refptr<PrivateKey> private_key);
+
+ // Puts request to perform sign-and-store operation in the queue.
+ void EnqueueSignAndStore(scoped_ptr<enterprise_management::PolicyData> policy,
+ const base::Closure& callback);
+
+ // Performs next operation in the queue.
+ void StartNextOperation();
+
+ // Called when sign-and-store operation completes it's work.
+ void HandleCompletedOperation(const base::Closure& callback,
+ SessionManagerOperation* operation,
+ DeviceSettingsService::Status status);
+
+ // Called when it's not possible to store settings.
+ void HandleError(DeviceSettingsService::Status status,
+ const base::Closure& callback);
// Returns testing instance of OwnerKeyUtil when it's set, otherwise
// returns |owner_key_util_|.
@@ -88,6 +117,11 @@ class OwnerSettingsService : public DeviceSettingsService::PrivateKeyDelegate,
// Profile this service instance belongs to.
Profile* profile_;
+ // User ID this service instance belongs to.
+ std::string user_id_;
+
+ scoped_refptr<PublicKey> public_key_;
+
scoped_refptr<PrivateKey> private_key_;
scoped_refptr<OwnerKeyUtil> owner_key_util_;
@@ -100,6 +134,10 @@ class OwnerSettingsService : public DeviceSettingsService::PrivateKeyDelegate,
// Whether TPM token still needs to be initialized.
bool waiting_for_tpm_token_;
+ // The queue of pending sign-and-store operations. The first operation on the
+ // queue is currently active; it gets removed and destroyed once it completes.
+ std::deque<SessionManagerOperation*> pending_operations_;
+
content::NotificationRegistrar registrar_;
base::ThreadChecker thread_checker_;
« no previous file with comments | « chrome/browser/chromeos/ownership/OWNERS ('k') | chrome/browser/chromeos/ownership/owner_settings_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698