OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" | 5 #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" |
6 | 6 |
| 7 #include "base/lazy_instance.h" |
7 #include "base/values.h" | 8 #include "base/values.h" |
8 #include "chrome/browser/chromeos/login/ownership_service.h" | 9 #include "chrome/browser/chromeos/login/ownership_service.h" |
9 #include "chrome/browser/chromeos/login/signed_settings.h" | 10 #include "chrome/browser/chromeos/login/signed_settings.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
11 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
12 | 13 |
| 14 static base::LazyInstance<chromeos::SignedSettings::Delegate<bool> > |
| 15 g_signed_settings_delegate(base::LINKER_INITIALIZED); |
| 16 |
13 namespace chromeos { | 17 namespace chromeos { |
14 | 18 |
15 // static | 19 // static |
16 void SignedSettingsTempStorage::RegisterPrefs(PrefService* local_state) { | 20 void SignedSettingsTempStorage::RegisterPrefs(PrefService* local_state) { |
17 local_state->RegisterDictionaryPref(prefs::kSignedSettingsTempStorage); | 21 local_state->RegisterDictionaryPref(prefs::kSignedSettingsTempStorage); |
18 } | 22 } |
19 | 23 |
20 // static | 24 // static |
21 bool SignedSettingsTempStorage::Store(const std::string& name, | 25 bool SignedSettingsTempStorage::Store(const std::string& name, |
22 const std::string& value, | 26 const std::string& value, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // before owner has been assigned. | 63 // before owner has been assigned. |
60 // Now owner is assigned and key is generated and we should persist | 64 // Now owner is assigned and key is generated and we should persist |
61 // those settings into signed storage. | 65 // those settings into signed storage. |
62 for (DictionaryValue::key_iterator it = temp_storage->begin_keys(); | 66 for (DictionaryValue::key_iterator it = temp_storage->begin_keys(); |
63 it != temp_storage->end_keys(); | 67 it != temp_storage->end_keys(); |
64 ++it) { | 68 ++it) { |
65 std::string value; | 69 std::string value; |
66 temp_storage->GetStringWithoutPathExpansion(*it, &value); | 70 temp_storage->GetStringWithoutPathExpansion(*it, &value); |
67 SignedSettings::CreateStorePropertyOp( | 71 SignedSettings::CreateStorePropertyOp( |
68 *it, value, | 72 *it, value, |
69 Singleton< SignedSettings::Delegate<bool> >::get())->Execute(); | 73 g_signed_settings_delegate.Pointer())->Execute(); |
70 } | 74 } |
71 local_state->ClearPref(prefs::kSignedSettingsTempStorage); | 75 local_state->ClearPref(prefs::kSignedSettingsTempStorage); |
72 } | 76 } |
73 } | 77 } |
74 } | 78 } |
75 | 79 |
76 } // namespace chromeos | 80 } // namespace chromeos |
OLD | NEW |