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

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

Issue 6773006: Add enableReferrers and enableHyperlinkAuditing to contentSettings.misc API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/pref_member.h ('k') | chrome/browser/profiles/off_the_record_profile_io_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_member.cc
diff --git a/chrome/browser/prefs/pref_member.cc b/chrome/browser/prefs/pref_member.cc
index 405aab63d850747d491fdfc6d5cc779a1373195c..2efeafc2c11523d7436b3c64e7e7a10bddd15fbb 100644
--- a/chrome/browser/prefs/pref_member.cc
+++ b/chrome/browser/prefs/pref_member.cc
@@ -18,8 +18,7 @@ PrefMemberBase::PrefMemberBase()
}
PrefMemberBase::~PrefMemberBase() {
- if (prefs_ && !pref_name_.empty())
- prefs_->RemovePrefObserver(pref_name_.c_str(), this);
+ Destroy();
}
@@ -38,7 +37,7 @@ void PrefMemberBase::Init(const char* pref_name, PrefService* prefs,
}
void PrefMemberBase::Destroy() {
- if (prefs_) {
+ if (prefs_ && !pref_name_.empty()) {
prefs_->RemovePrefObserver(pref_name_.c_str(), this);
prefs_ = NULL;
}
@@ -62,10 +61,6 @@ void PrefMemberBase::Observe(NotificationType type,
observer_->Observe(type, source, details);
}
-void PrefMemberBase::VerifyValuePrefName() const {
- DCHECK(!pref_name_.empty());
-}
-
void PrefMemberBase::UpdateValueFromPref() const {
VerifyValuePrefName();
const PrefService::Preference* pref =
@@ -76,6 +71,12 @@ void PrefMemberBase::UpdateValueFromPref() const {
internal()->UpdateValue(pref->GetValue()->DeepCopy(), pref->IsManaged());
}
+void PrefMemberBase::VerifyPref() const {
+ VerifyValuePrefName();
+ if (!internal())
+ UpdateValueFromPref();
+}
+
PrefMemberBase::Internal::Internal() : thread_id_(BrowserThread::UI) { }
PrefMemberBase::Internal::~Internal() { }
« no previous file with comments | « chrome/browser/prefs/pref_member.h ('k') | chrome/browser/profiles/off_the_record_profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698