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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 DCHECK(CalledOnValidThread()); | 290 DCHECK(CalledOnValidThread()); |
291 // Lookup the preference in the default store. | 291 // Lookup the preference in the default store. |
292 const base::Value* value = NULL; | 292 const base::Value* value = NULL; |
293 if (!pref_registry_->defaults()->GetValue(path, &value)) { | 293 if (!pref_registry_->defaults()->GetValue(path, &value)) { |
294 NOTREACHED() << "Default value missing for pref: " << path; | 294 NOTREACHED() << "Default value missing for pref: " << path; |
295 return NULL; | 295 return NULL; |
296 } | 296 } |
297 return value; | 297 return value; |
298 } | 298 } |
299 | 299 |
| 300 void PrefService::MarkUserStoreNeedsEmptyValue(const std::string& key) const { |
| 301 user_pref_store_->MarkNeedsEmptyValue(key); |
| 302 } |
| 303 |
300 const base::ListValue* PrefService::GetList(const char* path) const { | 304 const base::ListValue* PrefService::GetList(const char* path) const { |
301 DCHECK(CalledOnValidThread()); | 305 DCHECK(CalledOnValidThread()); |
302 | 306 |
303 const base::Value* value = GetPreferenceValue(path); | 307 const base::Value* value = GetPreferenceValue(path); |
304 if (!value) { | 308 if (!value) { |
305 NOTREACHED() << "Trying to read an unregistered pref: " << path; | 309 NOTREACHED() << "Trying to read an unregistered pref: " << path; |
306 return NULL; | 310 return NULL; |
307 } | 311 } |
308 if (value->GetType() != base::Value::TYPE_LIST) { | 312 if (value->GetType() != base::Value::TYPE_LIST) { |
309 NOTREACHED(); | 313 NOTREACHED(); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 DCHECK(found_value->IsType(default_type)); | 594 DCHECK(found_value->IsType(default_type)); |
591 return found_value; | 595 return found_value; |
592 } else { | 596 } else { |
593 // Every registered preference has at least a default value. | 597 // Every registered preference has at least a default value. |
594 NOTREACHED() << "no valid value found for registered pref " << path; | 598 NOTREACHED() << "no valid value found for registered pref " << path; |
595 } | 599 } |
596 } | 600 } |
597 | 601 |
598 return NULL; | 602 return NULL; |
599 } | 603 } |
OLD | NEW |