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

Unified Diff: chrome/browser/chromeos/ownership/owner_settings_service_chromeos.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: 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/ownership/owner_settings_service_chromeos.h
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service.h b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h
similarity index 51%
rename from chrome/browser/chromeos/ownership/owner_settings_service.h
rename to chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h
index 3419d4ff1b3e7dbee4934d40695b9576f55c34be..fcbaf57f825d5335a6a61b438fe7379ee7b9a5f0 100644
--- a/chrome/browser/chromeos/ownership/owner_settings_service.h
+++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h
@@ -2,27 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_H_
-#define CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_H_
+#ifndef CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_
+#define CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_
#include <deque>
#include <vector>
-#include "base/callback.h"
+#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/thread_checker.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chromeos/dbus/session_manager_client.h"
#include "chromeos/tpm_token_loader.h"
-#include "components/keyed_service/core/keyed_service.h"
-#include "components/ownership/owner_key_util.h"
+#include "components/ownership/owner_settings_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
class Profile;
+namespace ownership {
+class OwnerKeyUtil;
+}
+
namespace chromeos {
class SessionManagerOperation;
@@ -31,31 +32,16 @@ class SessionManagerOperation;
//
// TODO (ygorshenin@): move write path for device settings here
// (crbug.com/230018).
-class OwnerSettingsService : public DeviceSettingsService::PrivateKeyDelegate,
- public KeyedService,
- public content::NotificationObserver,
- public TPMTokenLoader::Observer,
- public SessionManagerClient::Observer {
+class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService,
+ public content::NotificationObserver,
+ public TPMTokenLoader::Observer,
+ public SessionManagerClient::Observer {
public:
- virtual ~OwnerSettingsService();
-
- base::WeakPtr<OwnerSettingsService> as_weak_ptr() {
- return weak_factory_.GetWeakPtr();
- }
+ virtual ~OwnerSettingsServiceChromeOS();
- // DeviceSettingsService::PrivateKeyDelegate implementation:
- virtual bool IsOwner() OVERRIDE;
- virtual void IsOwnerAsync(const IsOwnerCallback& callback) OVERRIDE;
- virtual bool AssembleAndSignPolicyAsync(
+ // ownership::OwnerSettingsService implementation:
+ virtual void SignAndStorePolicyAsync(
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:
@@ -81,23 +67,22 @@ class OwnerSettingsService : public DeviceSettingsService::PrivateKeyDelegate,
DeviceSettingsService* device_settings_service);
private:
- friend class OwnerSettingsServiceFactory;
+ friend class OwnerSettingsServiceChromeOSFactory;
- OwnerSettingsService(
+ OwnerSettingsServiceChromeOS(
Profile* profile,
const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util);
- // Reloads private key from profile's NSS slots. Responds via call
- // to OnPrivateKeyLoaded().
- void ReloadPrivateKey();
+ // OwnerSettingsService protected interface overrides:
- // Called when ReloadPrivateKey() completes it's work.
- void OnPrivateKeyLoaded(scoped_refptr<ownership::PublicKey> public_key,
- scoped_refptr<ownership::PrivateKey> private_key);
+ // Reloads private key from profile's NSS slots, responds via |callback|.
+ virtual void ReloadKeypairImpl(const base::Callback<
+ void(const scoped_refptr<ownership::PublicKey>& public_key,
+ const scoped_refptr<ownership::PrivateKey>& private_key)>& callback)
+ OVERRIDE;
- // Puts request to perform sign-and-store operation in the queue.
- void EnqueueSignAndStore(scoped_ptr<enterprise_management::PolicyData> policy,
- const base::Closure& callback);
+ // Possibly notifies DeviceSettingsService that owner's keypair is loaded.
+ virtual void OnPostKeypairLoadedActions() OVERRIDE;
// Performs next operation in the queue.
void StartNextOperation();
@@ -107,33 +92,12 @@ class OwnerSettingsService : public DeviceSettingsService::PrivateKeyDelegate,
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_|.
- scoped_refptr<ownership::OwnerKeyUtil> GetOwnerKeyUtil();
-
- // Returns testing instance of DeviceSettingsService when it's set,
- // otherwise returns pointer to a singleton instance, when it's
- // initialized.
- DeviceSettingsService* GetDeviceSettingsService();
-
// Profile this service instance belongs to.
Profile* profile_;
// User ID this service instance belongs to.
std::string user_id_;
- scoped_refptr<ownership::PublicKey> public_key_;
-
- scoped_refptr<ownership::PrivateKey> private_key_;
-
- scoped_refptr<ownership::OwnerKeyUtil> owner_key_util_;
-
- std::vector<IsOwnerCallback> pending_is_owner_callbacks_;
-
// Whether profile still needs to be initialized.
bool waiting_for_profile_creation_;
@@ -146,13 +110,11 @@ class OwnerSettingsService : public DeviceSettingsService::PrivateKeyDelegate,
content::NotificationRegistrar registrar_;
- base::ThreadChecker thread_checker_;
-
- base::WeakPtrFactory<OwnerSettingsService> weak_factory_;
+ base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(OwnerSettingsService);
+ DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS);
};
} // namespace chromeos
-#endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_H_
+#endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_

Powered by Google App Engine
This is Rietveld 408576698