OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/prefs/pref_service.h" | 5 #include "chrome/browser/prefs/pref_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // an example problem that this can cause. | 125 // an example problem that this can cause. |
126 // Do some diagnosis and try to avoid losing data. | 126 // Do some diagnosis and try to avoid losing data. |
127 int message_id = 0; | 127 int message_id = 0; |
128 if (error <= PrefStore::PREF_READ_ERROR_JSON_TYPE) { | 128 if (error <= PrefStore::PREF_READ_ERROR_JSON_TYPE) { |
129 message_id = IDS_PREFERENCES_CORRUPT_ERROR; | 129 message_id = IDS_PREFERENCES_CORRUPT_ERROR; |
130 } else if (error != PrefStore::PREF_READ_ERROR_NO_FILE) { | 130 } else if (error != PrefStore::PREF_READ_ERROR_NO_FILE) { |
131 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; | 131 message_id = IDS_PREFERENCES_UNREADABLE_ERROR; |
132 } | 132 } |
133 | 133 |
134 if (message_id) { | 134 if (message_id) { |
135 ChromeThread::PostTask(ChromeThread::UI, FROM_HERE, | 135 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
136 NewRunnableFunction(&NotifyReadError, this, message_id)); | 136 NewRunnableFunction(&NotifyReadError, this, message_id)); |
137 } | 137 } |
138 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 20); | 138 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 20); |
139 } | 139 } |
140 | 140 |
141 bool PrefService::ReloadPersistentPrefs() { | 141 bool PrefService::ReloadPersistentPrefs() { |
142 return (LoadPersistentPrefs() == PrefStore::PREF_READ_ERROR_NONE); | 142 return (LoadPersistentPrefs() == PrefStore::PREF_READ_ERROR_NONE); |
143 } | 143 } |
144 | 144 |
145 PrefStore::PrefReadError PrefService::LoadPersistentPrefs() { | 145 PrefStore::PrefReadError PrefService::LoadPersistentPrefs() { |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 627 |
628 bool PrefService::Preference::IsDefaultValue() const { | 628 bool PrefService::Preference::IsDefaultValue() const { |
629 return pref_service_->pref_value_store_-> | 629 return pref_service_->pref_value_store_-> |
630 PrefValueFromDefaultStore(name_.c_str()); | 630 PrefValueFromDefaultStore(name_.c_str()); |
631 } | 631 } |
632 | 632 |
633 bool PrefService::Preference::IsUserModifiable() const { | 633 bool PrefService::Preference::IsUserModifiable() const { |
634 return pref_service_->pref_value_store_-> | 634 return pref_service_->pref_value_store_-> |
635 PrefValueUserModifiable(name_.c_str()); | 635 PrefValueUserModifiable(name_.c_str()); |
636 } | 636 } |
OLD | NEW |