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/pref_service.h" | 5 #include "chrome/browser/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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 400 } |
401 | 401 |
402 const PrefService::Preference* PrefService::FindPreference( | 402 const PrefService::Preference* PrefService::FindPreference( |
403 const wchar_t* pref_name) const { | 403 const wchar_t* pref_name) const { |
404 DCHECK(CalledOnValidThread()); | 404 DCHECK(CalledOnValidThread()); |
405 Preference p(NULL, pref_name, NULL); | 405 Preference p(NULL, pref_name, NULL); |
406 PreferenceSet::const_iterator it = prefs_.find(&p); | 406 PreferenceSet::const_iterator it = prefs_.find(&p); |
407 return it == prefs_.end() ? NULL : *it; | 407 return it == prefs_.end() ? NULL : *it; |
408 } | 408 } |
409 | 409 |
| 410 bool PrefService::IsManagedPreference(const wchar_t* pref_name) const { |
| 411 const Preference* pref = FindPreference(pref_name); |
| 412 if (pref && pref->IsManaged()) { |
| 413 return true; |
| 414 } |
| 415 return false; |
| 416 } |
| 417 |
410 void PrefService::FireObserversIfChanged(const wchar_t* path, | 418 void PrefService::FireObserversIfChanged(const wchar_t* path, |
411 const Value* old_value) { | 419 const Value* old_value) { |
412 if (PrefIsChanged(path, old_value)) | 420 if (PrefIsChanged(path, old_value)) |
413 FireObservers(path); | 421 FireObservers(path); |
414 } | 422 } |
415 | 423 |
416 bool PrefService::PrefIsChanged(const wchar_t* path, | 424 bool PrefService::PrefIsChanged(const wchar_t* path, |
417 const Value* old_value) { | 425 const Value* old_value) { |
418 Value* new_value = NULL; | 426 Value* new_value = NULL; |
419 pref_value_store_->GetValue(path, &new_value); | 427 pref_value_store_->GetValue(path, &new_value); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 return pref_value_store_->PrefValueInUserStore(name_.c_str()); | 865 return pref_value_store_->PrefValueInUserStore(name_.c_str()); |
858 } | 866 } |
859 | 867 |
860 bool PrefService::Preference::IsExtensionControlled() const { | 868 bool PrefService::Preference::IsExtensionControlled() const { |
861 return pref_value_store_->PrefValueFromExtensionStore(name_.c_str()); | 869 return pref_value_store_->PrefValueFromExtensionStore(name_.c_str()); |
862 } | 870 } |
863 | 871 |
864 bool PrefService::Preference::IsUserControlled() const { | 872 bool PrefService::Preference::IsUserControlled() const { |
865 return pref_value_store_->PrefValueFromUserStore(name_.c_str()); | 873 return pref_value_store_->PrefValueFromUserStore(name_.c_str()); |
866 } | 874 } |
OLD | NEW |