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

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

Issue 7838030: WIP: Introduce per-TabContents PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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/prefs/pref_notifier_impl.cc
diff --git a/chrome/browser/prefs/pref_notifier_impl.cc b/chrome/browser/prefs/pref_notifier_impl.cc
index 2dd454f948092ed223eeaf2916302ae64ff8a561..d84d51e5cdb91dc2796480dc05fb1b9425afd8e5 100644
--- a/chrome/browser/prefs/pref_notifier_impl.cc
+++ b/chrome/browser/prefs/pref_notifier_impl.cc
@@ -5,13 +5,15 @@
#include "chrome/browser/prefs/pref_notifier_impl.h"
#include "base/stl_util.h"
+#include "chrome/browser/prefs/pref_model_associator.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_service.h"
-PrefNotifierImpl::PrefNotifierImpl(PrefService* service)
- : pref_service_(service) {
+PrefNotifierImpl::PrefNotifierImpl()
+ : pref_service_(NULL),
+ pref_model_associator_(NULL) {
}
PrefNotifierImpl::~PrefNotifierImpl() {
@@ -71,6 +73,14 @@ void PrefNotifierImpl::RemovePrefObserver(const char* path,
observer_list->RemoveObserver(obs);
}
+void PrefNotifierImpl::SetSource(PrefService* pref_service) {
+ pref_service_ = pref_service;
+}
+
+void PrefNotifierImpl::SetPrefModelAssociator(PrefModelAssociator* associator) {
+ pref_model_associator_ = associator;
+}
+
void PrefNotifierImpl::OnPreferenceChanged(const std::string& path) {
FireObservers(path);
}
@@ -88,9 +98,13 @@ void PrefNotifierImpl::FireObservers(const std::string& path) {
DCHECK(CalledOnValidThread());
// Only send notifications for registered preferences.
- if (!pref_service_->FindPreference(path.c_str()))
+ if (!pref_service_ || !pref_service_->FindPreference(path.c_str()))
return;
+ // Notify the associator.
+ if (pref_model_associator_)
+ pref_model_associator_->ProcessPrefChange(path);
+
const PrefObserverMap::iterator observer_iterator =
pref_observers_.find(path);
if (observer_iterator == pref_observers_.end())

Powered by Google App Engine
This is Rietveld 408576698