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 "chrome/browser/prefs/pref_service.h" | 5 #include "chrome/browser/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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 DCHECK(CalledOnValidThread()); | 338 DCHECK(CalledOnValidThread()); |
339 | 339 |
340 PreferenceMap::iterator it = prefs_map_.find(path); | 340 PreferenceMap::iterator it = prefs_map_.find(path); |
341 CHECK(it != prefs_map_.end()) << "Trying to unregister an unregistered pref: " | 341 CHECK(it != prefs_map_.end()) << "Trying to unregister an unregistered pref: " |
342 << path; | 342 << path; |
343 | 343 |
344 prefs_map_.erase(it); | 344 prefs_map_.erase(it); |
345 default_store_->RemoveDefaultValue(path); | 345 default_store_->RemoveDefaultValue(path); |
346 } | 346 } |
347 | 347 |
| 348 bool PrefService::AllowPrefRegistrarSimple() const { |
| 349 return true; |
| 350 } |
| 351 |
348 void PrefService::ClearPref(const char* path) { | 352 void PrefService::ClearPref(const char* path) { |
349 DCHECK(CalledOnValidThread()); | 353 DCHECK(CalledOnValidThread()); |
350 | 354 |
351 const Preference* pref = FindPreference(path); | 355 const Preference* pref = FindPreference(path); |
352 if (!pref) { | 356 if (!pref) { |
353 NOTREACHED() << "Trying to clear an unregistered pref: " << path; | 357 NOTREACHED() << "Trying to clear an unregistered pref: " << path; |
354 return; | 358 return; |
355 } | 359 } |
356 user_pref_store_->RemoveValue(path); | 360 user_pref_store_->RemoveValue(path); |
357 } | 361 } |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 const Value* found_value = NULL; | 571 const Value* found_value = NULL; |
568 if (pref_value_store_->GetValue(path, type, &found_value)) { | 572 if (pref_value_store_->GetValue(path, type, &found_value)) { |
569 DCHECK(found_value->IsType(type)); | 573 DCHECK(found_value->IsType(type)); |
570 return found_value; | 574 return found_value; |
571 } | 575 } |
572 | 576 |
573 // Every registered preference has at least a default value. | 577 // Every registered preference has at least a default value. |
574 NOTREACHED() << "no valid value found for registered pref " << path; | 578 NOTREACHED() << "no valid value found for registered pref " << path; |
575 return NULL; | 579 return NULL; |
576 } | 580 } |
OLD | NEW |