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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } else { | 80 } else { |
81 // Guarantee that initialization happens after this function returned. | 81 // Guarantee that initialization happens after this function returned. |
82 base::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() { | |
91 return user_pref_store_->ReadPrefs() == | |
92 PersistentPrefStore::PREF_READ_ERROR_NONE; | |
93 } | |
94 | |
95 void PrefService::CommitPendingWrite() { | 90 void PrefService::CommitPendingWrite() { |
96 DCHECK(CalledOnValidThread()); | 91 DCHECK(CalledOnValidThread()); |
97 user_pref_store_->CommitPendingWrite(); | 92 user_pref_store_->CommitPendingWrite(); |
98 } | 93 } |
99 | 94 |
100 bool PrefService::GetBoolean(const char* path) const { | 95 bool PrefService::GetBoolean(const char* path) const { |
101 DCHECK(CalledOnValidThread()); | 96 DCHECK(CalledOnValidThread()); |
102 | 97 |
103 bool result = false; | 98 bool result = false; |
104 | 99 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 DCHECK(found_value->IsType(default_type)); | 577 DCHECK(found_value->IsType(default_type)); |
583 return found_value; | 578 return found_value; |
584 } else { | 579 } else { |
585 // Every registered preference has at least a default value. | 580 // Every registered preference has at least a default value. |
586 NOTREACHED() << "no valid value found for registered pref " << path; | 581 NOTREACHED() << "no valid value found for registered pref " << path; |
587 } | 582 } |
588 } | 583 } |
589 | 584 |
590 return NULL; | 585 return NULL; |
591 } | 586 } |
OLD | NEW |