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

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

Issue 1825173003: [Policy Experimental] Add "recommended" policies for URL exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 4 years, 8 months 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
« no previous file with comments | « components/prefs/pref_service.h ('k') | components/prefs/pref_value_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/prefs/pref_service.h" 5 #include "components/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 base::Value::Type PrefService::Preference::GetType() const { 531 base::Value::Type PrefService::Preference::GetType() const {
532 return type_; 532 return type_;
533 } 533 }
534 534
535 const base::Value* PrefService::Preference::GetValue() const { 535 const base::Value* PrefService::Preference::GetValue() const {
536 const base::Value* result= pref_service_->GetPreferenceValue(name_); 536 const base::Value* result= pref_service_->GetPreferenceValue(name_);
537 DCHECK(result) << "Must register pref before getting its value"; 537 DCHECK(result) << "Must register pref before getting its value";
538 return result; 538 return result;
539 } 539 }
540 540
541 const base::Value* PrefService::Preference::GetManagedValue() const {
542 DCHECK(pref_service_->FindPreference(name_))
543 << "Must register pref before getting its value";
544
545 const base::Value* found_value = nullptr;
546 if (pref_value_store()->GetManagedValue(name_, type_, &found_value)) {
547 DCHECK(found_value->IsType(type_));
548 return found_value;
549 }
550
551 // The pref has no managed value.
552 return nullptr;
553 }
554
541 const base::Value* PrefService::Preference::GetRecommendedValue() const { 555 const base::Value* PrefService::Preference::GetRecommendedValue() const {
542 DCHECK(pref_service_->FindPreference(name_)) 556 DCHECK(pref_service_->FindPreference(name_))
543 << "Must register pref before getting its value"; 557 << "Must register pref before getting its value";
544 558
545 const base::Value* found_value = NULL; 559 const base::Value* found_value = nullptr;
546 if (pref_value_store()->GetRecommendedValue(name_, type_, &found_value)) { 560 if (pref_value_store()->GetRecommendedValue(name_, type_, &found_value)) {
547 DCHECK(found_value->IsType(type_)); 561 DCHECK(found_value->IsType(type_));
548 return found_value; 562 return found_value;
549 } 563 }
550 564
551 // The pref has no recommended value. 565 // The pref has no recommended value.
552 return NULL; 566 return nullptr;
553 } 567 }
554 568
555 bool PrefService::Preference::IsManaged() const { 569 bool PrefService::Preference::IsManaged() const {
556 return pref_value_store()->PrefValueInManagedStore(name_); 570 return pref_value_store()->PrefValueInManagedStore(name_);
557 } 571 }
558 572
559 bool PrefService::Preference::IsManagedByCustodian() const { 573 bool PrefService::Preference::IsManagedByCustodian() const {
560 return pref_value_store()->PrefValueInSupervisedStore(name_.c_str()); 574 return pref_value_store()->PrefValueInSupervisedStore(name_.c_str());
561 } 575 }
562 576
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 DCHECK(found_value->IsType(default_type)); 625 DCHECK(found_value->IsType(default_type));
612 return found_value; 626 return found_value;
613 } else { 627 } else {
614 // Every registered preference has at least a default value. 628 // Every registered preference has at least a default value.
615 NOTREACHED() << "no valid value found for registered pref " << path; 629 NOTREACHED() << "no valid value found for registered pref " << path;
616 } 630 }
617 } 631 }
618 632
619 return NULL; 633 return NULL;
620 } 634 }
OLDNEW
« no previous file with comments | « components/prefs/pref_service.h ('k') | components/prefs/pref_value_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698