Chromium Code Reviews| Index: chrome/browser/prefs/pref_service.cc |
| diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc |
| index 9071f24898abe56a4e2f85186565ff74c218e880..beb4841d8619659b1e9fd1072420cdfed3d9d030 100644 |
| --- a/chrome/browser/prefs/pref_service.cc |
| +++ b/chrome/browser/prefs/pref_service.cc |
| @@ -194,9 +194,15 @@ PrefService::~PrefService() { |
| default_store_ = NULL; |
| } |
| -void PrefService::OnPrefsRead(PersistentPrefStore::PrefReadError error, |
| - bool no_dir) { |
| - if (no_dir) { |
| +void PrefService::OnInitializationCompleted() { |
|
Mattias Nissler (ping if slow)
2011/04/26 09:04:26
If we use the PREF_INITIALIZATION_COMPLETED notifi
altimofeev
2011/04/27 10:32:08
I have leaved "PrefStore::Observer" here, because
Mattias Nissler (ping if slow)
2011/04/27 12:16:30
Yes, PrefNotifier already has OnInitializationComp
|
| + // This is the only message PrefService is waiting for, so remove us from the |
| + // observers list. |
| + user_pref_store_->RemoveObserver(this); |
| + |
| + PersistentPrefStore::PrefReadError error; |
| + bool is_fatal; |
| + user_pref_store_->GetErrors(&error, &is_fatal); |
|
Bernhard Bauer
2011/04/25 15:54:10
Could you pass these values directly to OnInitiali
altimofeev
2011/04/27 10:32:08
The problem is that "OnInitializationCompleted" is
Bernhard Bauer
2011/04/27 10:52:16
I think passing (PREF_READ_ERROR_NONE, false) at t
Mattias Nissler (ping if slow)
2011/04/27 12:16:30
I think passing the parameters makes sense. At the
|
| + if (is_fatal) { |
| // Bad news. When profile is created, the process that creates the directory |
| // is explicitly started. So if directory is missing it probably means that |
| // Chromium hasn't sufficient privileges. |
| @@ -228,13 +234,11 @@ void PrefService::OnPrefsRead(PersistentPrefStore::PrefReadError error, |
| } |
| void PrefService::InitFromStorage() { |
| + user_pref_store_->AddObserver(this); |
| if (!delegate_) { |
| - const PersistentPrefStore::PrefReadError error = |
| - user_pref_store_->ReadPrefs(); |
| - OnPrefsRead(error, false); |
| + user_pref_store_->ReadPrefs(); |
| } else { |
| - // todo(altimofeev): move this method to PersistentPrefStore interface. |
| - (static_cast<JsonPrefStore*>(user_pref_store_.get()))->ReadPrefs(this); |
| + user_pref_store_.get()->ReadPrefsAsync(); |
| } |
| } |