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

Unified Diff: chrome/browser/chromeos/signed_settings_migration_helper.cc

Issue 10824112: Move Chrome OS device settings stuff to chrome/browser/chromeos/settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 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/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
deleted file mode 100644
index 53ef58f39d6ddf8553fc81b961690f6b9b0c2f8d..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/signed_settings_migration_helper.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/signed_settings_migration_helper.h"
-
-#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();
-}
-
-void SignedSettingsMigrationHelper::AddMigrationValue(const std::string& path,
- base::Value* value) {
- migration_values_.SetValue(path, value);
-}
-
-void SignedSettingsMigrationHelper::MigrateValues(void) {
- ptr_factory_.InvalidateWeakPtrs();
- OwnershipService::GetSharedInstance()->GetStatusAsync(
- 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,
- bool current_user_is_owner) {
- // We can call StartStorePropertyOp 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) {
- std::map<std::string, base::Value*>::const_iterator i;
- for (i = migration_values_.begin(); i != migration_values_.end(); ++i) {
- // Queue all values for storing.
- CrosSettings::Get()->Set(i->first, *i->second);
- }
- migration_values_.Clear();
- }
-}
-
-} // namespace chromeos
-
« no previous file with comments | « chrome/browser/chromeos/signed_settings_migration_helper.h ('k') | chrome/browser/chromeos/stub_cros_settings_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698