OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/protector/protected_prefs_watcher.h" | 5 #include "chrome/browser/protector/protected_prefs_watcher.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const content::NotificationSource& source, | 144 const content::NotificationSource& source, |
145 const content::NotificationDetails& details) { | 145 const content::NotificationDetails& details) { |
146 DCHECK(type == chrome::NOTIFICATION_PREF_CHANGED); | 146 DCHECK(type == chrome::NOTIFICATION_PREF_CHANGED); |
147 const std::string* pref_name = content::Details<std::string>(details).ptr(); | 147 const std::string* pref_name = content::Details<std::string>(details).ptr(); |
148 DCHECK(pref_name && pref_observer_->IsObserved(*pref_name)); | 148 DCHECK(pref_name && pref_observer_->IsObserved(*pref_name)); |
149 if (UpdateBackupEntry(*pref_name)) | 149 if (UpdateBackupEntry(*pref_name)) |
150 UpdateBackupSignature(); | 150 UpdateBackupSignature(); |
151 } | 151 } |
152 | 152 |
153 void ProtectedPrefsWatcher::EnsurePrefsMigration() { | 153 void ProtectedPrefsWatcher::EnsurePrefsMigration() { |
154 SessionStartupPref::MigrateIfNecessary(profile_->GetPrefs()); | 154 // Force SessionStartupPref migration, if necessary. |
| 155 SessionStartupPref::GetStartupPref(profile_); |
155 } | 156 } |
156 | 157 |
157 bool ProtectedPrefsWatcher::UpdateCachedPrefs() { | 158 bool ProtectedPrefsWatcher::UpdateCachedPrefs() { |
158 // Direct access to the extensions prefs is required becase ExtensionService | 159 // Direct access to the extensions prefs is required becase ExtensionService |
159 // may not yet have been initialized. | 160 // may not yet have been initialized. |
160 ExtensionPrefs::ExtensionIdSet extension_ids = | 161 ExtensionPrefs::ExtensionIdSet extension_ids = |
161 ExtensionPrefs::GetExtensionsFrom( | 162 ExtensionPrefs::GetExtensionsFrom( |
162 profile_->GetPrefs()->GetDictionary(ExtensionPrefs::kExtensionsPref)); | 163 profile_->GetPrefs()->GetDictionary(ExtensionPrefs::kExtensionsPref)); |
163 if (extension_ids == cached_extension_ids_) | 164 if (extension_ids == cached_extension_ids_) |
164 return false; | 165 return false; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 NOTREACHED(); | 332 NOTREACHED(); |
332 continue; | 333 continue; |
333 } | 334 } |
334 StringAppendStringDictionary(tab, &data); | 335 StringAppendStringDictionary(tab, &data); |
335 } | 336 } |
336 } | 337 } |
337 return data; | 338 return data; |
338 } | 339 } |
339 | 340 |
340 } // namespace protector | 341 } // namespace protector |
OLD | NEW |