| 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 // Force SessionStartupPref migration, if necessary. | 154 SessionStartupPref::MigrateIfNecessary(profile_->GetPrefs()); |
| 155 SessionStartupPref::GetStartupPref(profile_); | |
| 156 } | 155 } |
| 157 | 156 |
| 158 bool ProtectedPrefsWatcher::UpdateCachedPrefs() { | 157 bool ProtectedPrefsWatcher::UpdateCachedPrefs() { |
| 159 // Direct access to the extensions prefs is required becase ExtensionService | 158 // Direct access to the extensions prefs is required becase ExtensionService |
| 160 // may not yet have been initialized. | 159 // may not yet have been initialized. |
| 161 ExtensionPrefs::ExtensionIdSet extension_ids = | 160 ExtensionPrefs::ExtensionIdSet extension_ids = |
| 162 ExtensionPrefs::GetExtensionsFrom( | 161 ExtensionPrefs::GetExtensionsFrom( |
| 163 profile_->GetPrefs()->GetDictionary(ExtensionPrefs::kExtensionsPref)); | 162 profile_->GetPrefs()->GetDictionary(ExtensionPrefs::kExtensionsPref)); |
| 164 if (extension_ids == cached_extension_ids_) | 163 if (extension_ids == cached_extension_ids_) |
| 165 return false; | 164 return false; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 NOTREACHED(); | 331 NOTREACHED(); |
| 333 continue; | 332 continue; |
| 334 } | 333 } |
| 335 StringAppendStringDictionary(tab, &data); | 334 StringAppendStringDictionary(tab, &data); |
| 336 } | 335 } |
| 337 } | 336 } |
| 338 return data; | 337 return data; |
| 339 } | 338 } |
| 340 | 339 |
| 341 } // namespace protector | 340 } // namespace protector |
| OLD | NEW |