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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 value = new base::ListValue; | 425 value = new base::ListValue; |
426 } else { | 426 } else { |
427 NOTREACHED(); | 427 NOTREACHED(); |
428 } | 428 } |
429 user_pref_store_->SetValueSilently(path, value); | 429 user_pref_store_->SetValueSilently(path, value); |
430 } | 430 } |
431 return value; | 431 return value; |
432 } | 432 } |
433 | 433 |
434 void PrefService::ReportUserPrefChanged(const std::string& key) { | 434 void PrefService::ReportUserPrefChanged(const std::string& key) { |
| 435 DCHECK(CalledOnValidThread()); |
435 user_pref_store_->ReportValueChanged(key); | 436 user_pref_store_->ReportValueChanged(key); |
436 } | 437 } |
437 | 438 |
438 void PrefService::SetUserPrefValue(const char* path, base::Value* new_value) { | 439 void PrefService::SetUserPrefValue(const char* path, base::Value* new_value) { |
439 scoped_ptr<base::Value> owned_value(new_value); | 440 scoped_ptr<base::Value> owned_value(new_value); |
440 DCHECK(CalledOnValidThread()); | 441 DCHECK(CalledOnValidThread()); |
441 | 442 |
442 const Preference* pref = FindPreference(path); | 443 const Preference* pref = FindPreference(path); |
443 if (!pref) { | 444 if (!pref) { |
444 NOTREACHED() << "Trying to write an unregistered pref: " << path; | 445 NOTREACHED() << "Trying to write an unregistered pref: " << path; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 DCHECK(found_value->IsType(default_type)); | 547 DCHECK(found_value->IsType(default_type)); |
547 return found_value; | 548 return found_value; |
548 } else { | 549 } else { |
549 // Every registered preference has at least a default value. | 550 // Every registered preference has at least a default value. |
550 NOTREACHED() << "no valid value found for registered pref " << path; | 551 NOTREACHED() << "no valid value found for registered pref " << path; |
551 } | 552 } |
552 } | 553 } |
553 | 554 |
554 return NULL; | 555 return NULL; |
555 } | 556 } |
OLD | NEW |