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

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

Issue 10832035: Switch from SignedSettings to DeviceSettingsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, remove blocking GetOwnershipStatus() Created 8 years, 4 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_migration_helper.h
diff --git a/chrome/browser/chromeos/settings/device_settings_migration_helper.h b/chrome/browser/chromeos/settings/device_settings_migration_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..bbff7e06f9a8376a321f89ee754dc6ac54a48c94
--- /dev/null
+++ b/chrome/browser/chromeos/settings/device_settings_migration_helper.h
@@ -0,0 +1,49 @@
+// 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.
+
+#ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_MIGRATION_HELPER_H_
+#define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_MIGRATION_HELPER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/settings/device_settings_service.h"
+#include "chrome/browser/prefs/pref_value_map.h"
+
+namespace base {
+class Value;
+}
+
+namespace chromeos {
+
+// This class provides the means to migrate settings to the signed settings
+// store. It does one of three things - store the settings in the policy blob
+// immediately if the current user is the owner. Uses the DeviceSettingsCache if
+// there is no owner yet, or waits for an call from DeviceSettingsProvider to
+// delay the storing until the owner has logged in.
+class DeviceSettingsMigrationHelper {
+ public:
+ DeviceSettingsMigrationHelper();
+ virtual ~DeviceSettingsMigrationHelper();
+
+ // Adds a value to be migrated. The class takes ownership of the |value|.
+ void AddMigrationValue(const std::string& path, base::Value* value);
+
+ // Initiates values migration. If the device is already owned this will
+ // happen immediately if not it will wait for ownership login and finish the
+ // migration then.
+ void MigrateValues(void);
+
+ private:
+ // Does the actual migration when ownership has been confirmed.
+ void DoMigrateValues(DeviceSettingsService::OwnershipStatus status,
+ bool current_user_is_owner);
+
+ base::WeakPtrFactory<DeviceSettingsMigrationHelper> ptr_factory_;
+ PrefValueMap migration_values_;
+
+ DISALLOW_COPY_AND_ASSIGN(DeviceSettingsMigrationHelper);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_MIGRATION_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698