Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: base/prefs/pref_service.cc

Issue 822713002: Update from https://crrev.com/309415 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 default: 233 default:
234 return INITIALIZATION_STATUS_ERROR; 234 return INITIALIZATION_STATUS_ERROR;
235 } 235 }
236 } 236 }
237 237
238 bool PrefService::IsManagedPreference(const std::string& pref_name) const { 238 bool PrefService::IsManagedPreference(const std::string& pref_name) const {
239 const Preference* pref = FindPreference(pref_name); 239 const Preference* pref = FindPreference(pref_name);
240 return pref && pref->IsManaged(); 240 return pref && pref->IsManaged();
241 } 241 }
242 242
243 bool PrefService::IsPreferenceManagedByCustodian(
244 const std::string& pref_name) const {
245 const Preference* pref = FindPreference(pref_name);
246 return pref && pref->IsManagedByCustodian();
247 }
248
243 bool PrefService::IsUserModifiablePreference( 249 bool PrefService::IsUserModifiablePreference(
244 const std::string& pref_name) const { 250 const std::string& pref_name) const {
245 const Preference* pref = FindPreference(pref_name); 251 const Preference* pref = FindPreference(pref_name);
246 return pref && pref->IsUserModifiable(); 252 return pref && pref->IsUserModifiable();
247 } 253 }
248 254
249 const base::DictionaryValue* PrefService::GetDictionary( 255 const base::DictionaryValue* PrefService::GetDictionary(
250 const std::string& path) const { 256 const std::string& path) const {
251 DCHECK(CalledOnValidThread()); 257 DCHECK(CalledOnValidThread());
252 258
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 516 }
511 517
512 // The pref has no recommended value. 518 // The pref has no recommended value.
513 return NULL; 519 return NULL;
514 } 520 }
515 521
516 bool PrefService::Preference::IsManaged() const { 522 bool PrefService::Preference::IsManaged() const {
517 return pref_value_store()->PrefValueInManagedStore(name_); 523 return pref_value_store()->PrefValueInManagedStore(name_);
518 } 524 }
519 525
526 bool PrefService::Preference::IsManagedByCustodian() const {
527 return pref_value_store()->PrefValueInSupervisedStore(name_.c_str());
528 }
529
520 bool PrefService::Preference::IsRecommended() const { 530 bool PrefService::Preference::IsRecommended() const {
521 return pref_value_store()->PrefValueFromRecommendedStore(name_); 531 return pref_value_store()->PrefValueFromRecommendedStore(name_);
522 } 532 }
523 533
524 bool PrefService::Preference::HasExtensionSetting() const { 534 bool PrefService::Preference::HasExtensionSetting() const {
525 return pref_value_store()->PrefValueInExtensionStore(name_); 535 return pref_value_store()->PrefValueInExtensionStore(name_);
526 } 536 }
527 537
528 bool PrefService::Preference::HasUserSetting() const { 538 bool PrefService::Preference::HasUserSetting() const {
529 return pref_value_store()->PrefValueInUserStore(name_); 539 return pref_value_store()->PrefValueInUserStore(name_);
(...skipping 30 matching lines...) Expand all
560 DCHECK(found_value->IsType(default_type)); 570 DCHECK(found_value->IsType(default_type));
561 return found_value; 571 return found_value;
562 } else { 572 } else {
563 // Every registered preference has at least a default value. 573 // Every registered preference has at least a default value.
564 NOTREACHED() << "no valid value found for registered pref " << path; 574 NOTREACHED() << "no valid value found for registered pref " << path;
565 } 575 }
566 } 576 }
567 577
568 return NULL; 578 return NULL;
569 } 579 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698