| Index: chrome/browser/chromeos/signed_settings_migration_helper.cc
|
| diff --git a/chrome/browser/chromeos/signed_settings_migration_helper.cc b/chrome/browser/chromeos/signed_settings_migration_helper.cc
|
| index 53ef58f39d6ddf8553fc81b961690f6b9b0c2f8d..2bd16989999e3bb96ea61ebd095268df944f596e 100644
|
| --- a/chrome/browser/chromeos/signed_settings_migration_helper.cc
|
| +++ b/chrome/browser/chromeos/signed_settings_migration_helper.cc
|
| @@ -7,19 +7,14 @@
|
| #include "base/bind.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/chromeos/cros_settings.h"
|
| -#include "chrome/common/chrome_notification_types.h"
|
| -#include "content/public/browser/notification_service.h"
|
|
|
| namespace chromeos {
|
|
|
| SignedSettingsMigrationHelper::SignedSettingsMigrationHelper()
|
| : ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {
|
| - registrar_.Add(this, chrome::NOTIFICATION_OWNERSHIP_CHECKED,
|
| - content::NotificationService::AllSources());
|
| }
|
|
|
| SignedSettingsMigrationHelper::~SignedSettingsMigrationHelper() {
|
| - registrar_.RemoveAll();
|
| migration_values_.Clear();
|
| }
|
|
|
| @@ -30,29 +25,21 @@ void SignedSettingsMigrationHelper::AddMigrationValue(const std::string& path,
|
|
|
| void SignedSettingsMigrationHelper::MigrateValues(void) {
|
| ptr_factory_.InvalidateWeakPtrs();
|
| - OwnershipService::GetSharedInstance()->GetStatusAsync(
|
| + DeviceSettingsService::Get()->GetOwnershipStatusAsync(
|
| base::Bind(&SignedSettingsMigrationHelper::DoMigrateValues,
|
| ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| -// NotificationObserver overrides:
|
| -void SignedSettingsMigrationHelper::Observe(
|
| - int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - if (type == chrome::NOTIFICATION_OWNERSHIP_CHECKED)
|
| - MigrateValues();
|
| -}
|
| -
|
| void SignedSettingsMigrationHelper::DoMigrateValues(
|
| - OwnershipService::Status status,
|
| + DeviceSettingsService::OwnershipStatus status,
|
| bool current_user_is_owner) {
|
| - // We can call StartStorePropertyOp in two cases - either if the owner is
|
| + // We can call CrosSettings::Set in two cases - either if the owner is
|
| // currently logged in and the policy can be updated immediately or if there
|
| // is no owner yet in which case the value will be temporarily stored in the
|
| - // SignedSettingsCache until the device is owned. If none of these
|
| - // cases is met then we will wait for user change notification and retry.
|
| - if (current_user_is_owner || status != OwnershipService::OWNERSHIP_TAKEN) {
|
| + // cache until the device is owned. If none of these cases is met then we will
|
| + // wait for the next opportunity.
|
| + if (current_user_is_owner ||
|
| + status != DeviceSettingsService::OWNERSHIP_TAKEN) {
|
| std::map<std::string, base::Value*>::const_iterator i;
|
| for (i = migration_values_.begin(); i != migration_values_.end(); ++i) {
|
| // Queue all values for storing.
|
| @@ -63,4 +50,3 @@ void SignedSettingsMigrationHelper::DoMigrateValues(
|
| }
|
|
|
| } // namespace chromeos
|
| -
|
|
|