OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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_SIGNED_SETTINGS_MIGRATION_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SIGNED_SETTINGS_MIGRATION_HELPER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "chrome/browser/chromeos/login/ownership_status_checker.h" |
| 10 #include "chrome/browser/chromeos/login/signed_settings_helper.h" |
| 11 #include "chrome/browser/prefs/pref_value_map.h" |
| 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" |
| 14 |
| 15 namespace base { |
| 16 class Value; |
| 17 } |
| 18 |
| 19 namespace chromeos { |
| 20 |
| 21 // This class provides the means to migrate settings to the signed settings |
| 22 // store. It does one of three things - store the settings in the policy blob |
| 23 // immediately if the current user is the owner. Uses the |
| 24 // SignedSettingsCache if there is no owner yet, or waits for an |
| 25 // OWNERSHIP_CHECKED notification to delay the storing until the owner has |
| 26 // logged in. |
| 27 class SignedSettingsMigrationHelper : public content::NotificationObserver { |
| 28 public: |
| 29 SignedSettingsMigrationHelper(); |
| 30 virtual ~SignedSettingsMigrationHelper(); |
| 31 |
| 32 // Adds a value to be migrated. The class takes ownership of the |value|. |
| 33 void AddMigrationValue(const std::string& path, base::Value* value); |
| 34 |
| 35 // Initiates values migration. If the device is already owned this will |
| 36 // happen immediately if not it will wait for ownership login and finish the |
| 37 // migration then. |
| 38 void MigrateValues(void); |
| 39 |
| 40 // NotificationObserver overrides: |
| 41 virtual void Observe(int type, |
| 42 const content::NotificationSource& source, |
| 43 const content::NotificationDetails& details) OVERRIDE; |
| 44 |
| 45 private: |
| 46 // Does the actual migration when ownership has been confirmed. |
| 47 void DoMigrateValues(OwnershipService::Status status, |
| 48 bool current_user_is_owner); |
| 49 |
| 50 content::NotificationRegistrar registrar_; |
| 51 scoped_ptr<OwnershipStatusChecker> ownership_checker_; |
| 52 PrefValueMap migration_values_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(SignedSettingsMigrationHelper); |
| 55 }; |
| 56 |
| 57 } // namespace chromeos |
| 58 |
| 59 #endif // CHROME_BROWSER_CHROMEOS_SIGNED_SETTINGS_MIGRATION_HELPER_H_ |
OLD | NEW |