Chromium Code Reviews| Index: chrome/browser/prefs/pref_notifier_impl.cc |
| diff --git a/chrome/browser/prefs/pref_notifier_impl.cc b/chrome/browser/prefs/pref_notifier_impl.cc |
| index d5ad24c94338f2748ed19ca59291095f808a608b..a18b9d19b6a02e72922ac1cbb406370103de46db 100644 |
| --- a/chrome/browser/prefs/pref_notifier_impl.cc |
| +++ b/chrome/browser/prefs/pref_notifier_impl.cc |
| @@ -75,14 +75,38 @@ void PrefNotifierImpl::OnPreferenceChanged(const std::string& path) { |
| } |
| void PrefNotifierImpl::OnInitializationCompleted() { |
| - DCHECK(CalledOnValidThread()); |
| + pref_notifier_ready_ = true; |
| + NotifyInitializationCompleted(); |
| +} |
| + |
| +void PrefNotifierImpl::OnPersistentPrefsRead(bool success) { |
|
Mattias Nissler (ping if slow)
2011/04/27 12:16:30
We should really get this trigger through OnInitia
altimofeev
2011/05/04 13:46:14
Done.
|
| + if (!success) { |
| + NotifyInitializationFailed(); |
| + return; |
| + } |
| + persistent_prefs_ready_ = true; |
| + NotifyInitializationCompleted(); |
| +} |
| + |
| +void PrefNotifierImpl::NotifyInitializationCompleted() { |
| + if (!pref_notifier_ready_ || !persistent_prefs_ready_) |
| + return; |
| + DCHECK(CalledOnValidThread()); |
| NotificationService::current()->Notify( |
| NotificationType::PREF_INITIALIZATION_COMPLETED, |
| Source<PrefService>(pref_service_), |
| NotificationService::NoDetails()); |
| } |
| +void PrefNotifierImpl::NotifyInitializationFailed() { |
|
Mattias Nissler (ping if slow)
2011/04/27 12:16:30
We shouldn't have a second notification, but rathe
altimofeev
2011/05/04 13:46:14
Done.
|
| + DCHECK(CalledOnValidThread()); |
| + NotificationService::current()->Notify( |
| + NotificationType::PREF_INITIALIZATION_FAILED, |
| + Source<PrefService>(pref_service_), |
| + NotificationService::NoDetails()); |
| +} |
| + |
| void PrefNotifierImpl::FireObservers(const std::string& path) { |
| DCHECK(CalledOnValidThread()); |