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

Unified Diff: chrome/browser/api/prefs/pref_member.cc

Issue 10828345: Extract PrefServiceBase into chrome/browser/api. Use in api and autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/api/prefs/pref_member.cc
diff --git a/chrome/browser/api/prefs/pref_member.cc b/chrome/browser/api/prefs/pref_member.cc
index 42a9d15c8e2689f25bb57dff0cbdde21e573b489..08e5ce8375d5a300eada2a39a0ac28b36417261b 100644
--- a/chrome/browser/api/prefs/pref_member.cc
+++ b/chrome/browser/api/prefs/pref_member.cc
@@ -7,7 +7,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/value_conversions.h"
-#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/api/prefs/pref_service_base.h"
#include "chrome/common/chrome_notification_types.h"
using content::BrowserThread;
@@ -26,7 +26,7 @@ PrefMemberBase::~PrefMemberBase() {
void PrefMemberBase::Init(const char* pref_name,
- PrefService* prefs,
+ PrefServiceBase* prefs,
content::NotificationObserver* observer) {
DCHECK(pref_name);
DCHECK(prefs);
@@ -35,7 +35,7 @@ void PrefMemberBase::Init(const char* pref_name,
prefs_ = prefs;
pref_name_ = pref_name;
// Check that the preference is registered.
- DCHECK(prefs_->FindPreference(pref_name_.c_str()))
+ DCHECK(prefs_->GetUserPrefValue(pref_name_.c_str()))
Mattias Nissler (ping if slow) 2012/08/16 15:16:42 Wait, what's this? This is incorrect.
Jói 2012/08/16 15:34:18 See below.
<< pref_name << " not registered.";
// Add ourselves as a pref observer so we can keep our local value in sync.
@@ -69,12 +69,11 @@ void PrefMemberBase::Observe(int type,
void PrefMemberBase::UpdateValueFromPref() const {
VerifyValuePrefName();
- const PrefService::Preference* pref =
- prefs_->FindPreference(pref_name_.c_str());
- DCHECK(pref);
if (!internal())
CreateInternal();
- internal()->UpdateValue(pref->GetValue()->DeepCopy(), pref->IsManaged());
+ internal()->UpdateValue(
+ prefs_->GetUserPrefValue(pref_name_.c_str())->DeepCopy(),
Mattias Nissler (ping if slow) 2012/08/16 15:16:42 also incorrect
Jói 2012/08/16 15:34:18 This, and the thing above, was me trying to get ri
Mattias Nissler (ping if slow) 2012/08/16 16:48:33 You could indeed make a GetValue() function on Pre
+ prefs_->IsManagedPreference(pref_name_.c_str()));
}
void PrefMemberBase::VerifyPref() const {

Powered by Google App Engine
This is Rietveld 408576698