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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 pref_registry_ = NULL; | 72 pref_registry_ = NULL; |
73 user_pref_store_ = NULL; | 73 user_pref_store_ = NULL; |
74 pref_notifier_.reset(); | 74 pref_notifier_.reset(); |
75 } | 75 } |
76 | 76 |
77 void PrefService::InitFromStorage(bool async) { | 77 void PrefService::InitFromStorage(bool async) { |
78 if (!async) { | 78 if (!async) { |
79 read_error_callback_.Run(user_pref_store_->ReadPrefs()); | 79 read_error_callback_.Run(user_pref_store_->ReadPrefs()); |
80 } else { | 80 } else { |
81 // Guarantee that initialization happens after this function returned. | 81 // Guarantee that initialization happens after this function returned. |
82 MessageLoop::current()->PostTask( | 82 base::MessageLoop::current()->PostTask( |
83 FROM_HERE, | 83 FROM_HERE, |
84 base::Bind(&PersistentPrefStore::ReadPrefsAsync, | 84 base::Bind(&PersistentPrefStore::ReadPrefsAsync, |
85 user_pref_store_.get(), | 85 user_pref_store_.get(), |
86 new ReadErrorHandler(read_error_callback_))); | 86 new ReadErrorHandler(read_error_callback_))); |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 bool PrefService::ReloadPersistentPrefs() { | 90 bool PrefService::ReloadPersistentPrefs() { |
91 return user_pref_store_->ReadPrefs() == | 91 return user_pref_store_->ReadPrefs() == |
92 PersistentPrefStore::PREF_READ_ERROR_NONE; | 92 PersistentPrefStore::PREF_READ_ERROR_NONE; |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 DCHECK(found_value->IsType(default_type)); | 579 DCHECK(found_value->IsType(default_type)); |
580 return found_value; | 580 return found_value; |
581 } else { | 581 } else { |
582 // Every registered preference has at least a default value. | 582 // Every registered preference has at least a default value. |
583 NOTREACHED() << "no valid value found for registered pref " << path; | 583 NOTREACHED() << "no valid value found for registered pref " << path; |
584 } | 584 } |
585 } | 585 } |
586 | 586 |
587 return NULL; | 587 return NULL; |
588 } | 588 } |
OLD | NEW |