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

Side by Side Diff: chrome/browser/prefs/pref_notifier_impl.cc

Issue 8568019: Introduce per-tab preferences service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed ProfileSyncServicePreferenceTest tests Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/prefs/pref_notifier_impl.h" 5 #include "chrome/browser/prefs/pref_notifier_impl.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/common/chrome_notification_types.h" 9 #include "chrome/common/chrome_notification_types.h"
10 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_service.h" 11 #include "content/public/browser/notification_service.h"
12 12
13 PrefNotifierImpl::PrefNotifierImpl()
14 : pref_service_(NULL) {
15 }
16
13 PrefNotifierImpl::PrefNotifierImpl(PrefService* service) 17 PrefNotifierImpl::PrefNotifierImpl(PrefService* service)
14 : pref_service_(service) { 18 : pref_service_(service) {
15 } 19 }
16 20
17 PrefNotifierImpl::~PrefNotifierImpl() { 21 PrefNotifierImpl::~PrefNotifierImpl() {
18 DCHECK(CalledOnValidThread()); 22 DCHECK(CalledOnValidThread());
19 23
20 // Verify that there are no pref observers when we shut down. 24 // Verify that there are no pref observers when we shut down.
21 for (PrefObserverMap::iterator it = pref_observers_.begin(); 25 for (PrefObserverMap::iterator it = pref_observers_.begin();
22 it != pref_observers_.end(); ++it) { 26 it != pref_observers_.end(); ++it) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return; 101 return;
98 102
99 NotificationObserverList::Iterator it(*(observer_iterator->second)); 103 NotificationObserverList::Iterator it(*(observer_iterator->second));
100 content::NotificationObserver* observer; 104 content::NotificationObserver* observer;
101 while ((observer = it.GetNext()) != NULL) { 105 while ((observer = it.GetNext()) != NULL) {
102 observer->Observe(chrome::NOTIFICATION_PREF_CHANGED, 106 observer->Observe(chrome::NOTIFICATION_PREF_CHANGED,
103 content::Source<PrefService>(pref_service_), 107 content::Source<PrefService>(pref_service_),
104 content::Details<const std::string>(&path)); 108 content::Details<const std::string>(&path));
105 } 109 }
106 } 110 }
111
112 void PrefNotifierImpl::SetPrefService(PrefService* pref_service) {
113 DCHECK(pref_service_ == NULL);
114 pref_service_ = pref_service;
115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698