| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_MIGRATION_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_MIGRATION_HELPER_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 10 #include "chrome/browser/prefs/pref_value_map.h" |
| 11 |
| 12 namespace base { |
| 13 class Value; |
| 14 } |
| 15 |
| 16 namespace chromeos { |
| 17 |
| 18 // This class provides the means to migrate settings to the signed settings |
| 19 // store. It does one of three things - store the settings in the policy blob |
| 20 // immediately if the current user is the owner. Uses the DeviceSettingsCache if |
| 21 // there is no owner yet, or waits for an call from DeviceSettingsProvider to |
| 22 // delay the storing until the owner has logged in. |
| 23 class DeviceSettingsMigrationHelper { |
| 24 public: |
| 25 DeviceSettingsMigrationHelper(); |
| 26 virtual ~DeviceSettingsMigrationHelper(); |
| 27 |
| 28 // Adds a value to be migrated. The class takes ownership of the |value|. |
| 29 void AddMigrationValue(const std::string& path, base::Value* value); |
| 30 |
| 31 // Initiates values migration. If the device is already owned this will |
| 32 // happen immediately if not it will wait for ownership login and finish the |
| 33 // migration then. |
| 34 void MigrateValues(void); |
| 35 |
| 36 private: |
| 37 // Does the actual migration when ownership has been confirmed. |
| 38 void DoMigrateValues(DeviceSettingsService::OwnershipStatus status, |
| 39 bool current_user_is_owner); |
| 40 |
| 41 base::WeakPtrFactory<DeviceSettingsMigrationHelper> ptr_factory_; |
| 42 PrefValueMap migration_values_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsMigrationHelper); |
| 45 }; |
| 46 |
| 47 } // namespace chromeos |
| 48 |
| 49 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_MIGRATION_HELPER_H_ |
| OLD | NEW |