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

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

Issue 548323003: Non-plafrom-specific part of an OwnerSettingsService is moved to components/ownership/*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes to *.gypi and *.gn files. Created 6 years, 3 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 b514037ad74e168ab5fe99c0b03e6d5383a887e9..d29e6896c1c55e2e618f5e41b0642ed29fb721cb 100644
--- a/chrome/browser/chromeos/settings/device_settings_service.h
+++ b/chrome/browser/chromeos/settings/device_settings_service.h
@@ -17,6 +17,7 @@
#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/ownership/owner_settings_service.h"
#include "components/policy/core/common/cloud/cloud_policy_validator.h"
#include "crypto/scoped_nss_types.h"
#include "policy/proto/device_management_backend.pb.h"
@@ -82,48 +83,6 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
virtual void DeviceSettingsUpdated() = 0;
};
- class PrivateKeyDelegate {
- public:
- typedef base::Callback<void(bool is_owner)> IsOwnerCallback;
- typedef base::Callback<void(std::string policy_blob)>
- AssembleAndSignPolicyCallback;
-
- virtual ~PrivateKeyDelegate() {}
-
- // Returns whether current user is owner or not. When this method
- // is called too early, incorrect result can be returned because
- // private key loading may be in progress.
- virtual bool IsOwner() = 0;
-
- // Determines whether current user is owner or not, responds via
- // |callback|.
- virtual void IsOwnerAsync(const IsOwnerCallback& callback) = 0;
-
- // Assembles and signs |policy|, responds via |callback|.
- 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.
static void Initialize();
static bool IsInitialized();
@@ -205,7 +164,9 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
// Sets the identity of the user that's interacting with the service. This is
// relevant only for writing settings through SignAndStore().
void InitOwner(const std::string& username,
- const base::WeakPtr<PrivateKeyDelegate>& delegate);
+ const base::WeakPtr<ownership::OwnerSettingsService>&
+ owner_settings_service);
+
const std::string& GetUsername() const;
// Adds an observer.
@@ -218,7 +179,7 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
virtual void PropertyChangeComplete(bool success) OVERRIDE;
private:
- friend class OwnerSettingsService;
+ friend class OwnerSettingsServiceChromeOS;
// Enqueues a new operation. Takes ownership of |operation| and starts it
// right away if there is no active operation currently.
@@ -265,7 +226,7 @@ class DeviceSettingsService : public SessionManagerClient::Observer {
std::string username_;
scoped_refptr<ownership::PublicKey> public_key_;
- base::WeakPtr<PrivateKeyDelegate> delegate_;
+ base::WeakPtr<ownership::OwnerSettingsService> owner_settings_service_;
scoped_ptr<enterprise_management::PolicyData> policy_data_;
scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> device_settings_;

Powered by Google App Engine
This is Rietveld 408576698