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

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

Issue 421653006: Update "Predict network actions" UI setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move and improve migration routine. Created 6 years, 4 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
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 base::Value::Type PrefService::Preference::GetType() const { 479 base::Value::Type PrefService::Preference::GetType() const {
480 return type_; 480 return type_;
481 } 481 }
482 482
483 const base::Value* PrefService::Preference::GetValue() const { 483 const base::Value* PrefService::Preference::GetValue() const {
484 const base::Value* result= pref_service_->GetPreferenceValue(name_); 484 const base::Value* result= pref_service_->GetPreferenceValue(name_);
485 DCHECK(result) << "Must register pref before getting its value"; 485 DCHECK(result) << "Must register pref before getting its value";
486 return result; 486 return result;
487 } 487 }
488 488
489 const base::Value* PrefService::Preference::GetUserValue() const {
490 DCHECK(pref_service_->FindPreference(name_.c_str()))
491 << "Must register pref before getting its value";
492
493 const base::Value* found_value = NULL;
494 if (pref_value_store()->GetUserValue(name_, type_, &found_value)) {
495 DCHECK(found_value->IsType(type_));
496 return found_value;
497 }
498
499 // The pref has no user set value.
500 return NULL;
501 }
502
489 const base::Value* PrefService::Preference::GetRecommendedValue() const { 503 const base::Value* PrefService::Preference::GetRecommendedValue() const {
490 DCHECK(pref_service_->FindPreference(name_.c_str())) << 504 DCHECK(pref_service_->FindPreference(name_.c_str())) <<
491 "Must register pref before getting its value"; 505 "Must register pref before getting its value";
492 506
493 const base::Value* found_value = NULL; 507 const base::Value* found_value = NULL;
494 if (pref_value_store()->GetRecommendedValue(name_, type_, &found_value)) { 508 if (pref_value_store()->GetRecommendedValue(name_, type_, &found_value)) {
495 DCHECK(found_value->IsType(type_)); 509 DCHECK(found_value->IsType(type_));
496 return found_value; 510 return found_value;
497 } 511 }
498 512
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 DCHECK(found_value->IsType(default_type)); 561 DCHECK(found_value->IsType(default_type));
548 return found_value; 562 return found_value;
549 } else { 563 } else {
550 // Every registered preference has at least a default value. 564 // Every registered preference has at least a default value.
551 NOTREACHED() << "no valid value found for registered pref " << path; 565 NOTREACHED() << "no valid value found for registered pref " << path;
552 } 566 }
553 } 567 }
554 568
555 return NULL; 569 return NULL;
556 } 570 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698