diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 02:52:53 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-19 02:52:53 +0000 |
commit | 6c2381d5ec28a86536c07dfa4a398a2b6bc1a58c (patch) | |
tree | a75584b11b8ef188b4eb3376b9146e063823a916 /chrome/browser/prefs | |
parent | bf3ee201c1ca5112f7fd173fc4785aa52920c5c0 (diff) | |
download | chromium_src-6c2381d5ec28a86536c07dfa4a398a2b6bc1a58c.zip chromium_src-6c2381d5ec28a86536c07dfa4a398a2b6bc1a58c.tar.gz chromium_src-6c2381d5ec28a86536c07dfa4a398a2b6bc1a58c.tar.bz2 |
Move NotificationObserver, NotificationSource, and NotificationDetails to content/public/browser.
This patch got way bigger than I wanted, but once I moved NotificationDetails, I figured I might as well mvoe the others since they're in the same files. In hindsight, I should have converted a subset of files at a time by leaving a using statement in the header.
BUG=98716
TBR=joi
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106196 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prefs')
-rw-r--r-- | chrome/browser/prefs/pref_change_registrar.cc | 6 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_change_registrar.h | 10 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_change_registrar_unittest.cc | 18 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_member.cc | 6 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_member.h | 16 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_member_unittest.cc | 14 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_notifier_impl.cc | 18 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_notifier_impl.h | 9 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_notifier_impl_unittest.cc | 18 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_observer_mock.cc | 4 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_observer_mock.h | 12 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_service.cc | 4 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_service.h | 11 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_set_observer.cc | 10 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_set_observer.h | 18 | ||||
-rw-r--r-- | chrome/browser/prefs/pref_set_observer_unittest.cc | 18 |
16 files changed, 105 insertions, 87 deletions
diff --git a/chrome/browser/prefs/pref_change_registrar.cc b/chrome/browser/prefs/pref_change_registrar.cc index 64c60962..3531afd 100644 --- a/chrome/browser/prefs/pref_change_registrar.cc +++ b/chrome/browser/prefs/pref_change_registrar.cc @@ -22,7 +22,8 @@ void PrefChangeRegistrar::Init(PrefService* service) { service_ = service; } -void PrefChangeRegistrar::Add(const char* path, NotificationObserver* obs) { +void PrefChangeRegistrar::Add(const char* path, + content::NotificationObserver* obs) { if (!service_) { NOTREACHED(); return; @@ -36,7 +37,8 @@ void PrefChangeRegistrar::Add(const char* path, NotificationObserver* obs) { service_->AddPrefObserver(path, obs); } -void PrefChangeRegistrar::Remove(const char* path, NotificationObserver* obs) { +void PrefChangeRegistrar::Remove(const char* path, + content::NotificationObserver* obs) { if (!service_) { NOTREACHED(); return; diff --git a/chrome/browser/prefs/pref_change_registrar.h b/chrome/browser/prefs/pref_change_registrar.h index 773c556..0278bdb 100644 --- a/chrome/browser/prefs/pref_change_registrar.h +++ b/chrome/browser/prefs/pref_change_registrar.h @@ -12,7 +12,10 @@ #include "base/basictypes.h" class PrefService; + +namespace content { class NotificationObserver; +} // Automatically manages the registration of one or more pref change observers // with a PrefStore. Functions much like NotificationRegistrar, but specifically @@ -32,12 +35,12 @@ class PrefChangeRegistrar { // when the registrar's destructor is called unless the observer has been // explicitly removed by a call to Remove beforehand. void Add(const char* path, - NotificationObserver* obs); + content::NotificationObserver* obs); // Removes a preference observer that has previously been added with a call to // Add. void Remove(const char* path, - NotificationObserver* obs); + content::NotificationObserver* obs); // Removes all observers that have been previously added with a call to Add. void RemoveAll(); @@ -46,7 +49,8 @@ class PrefChangeRegistrar { bool IsEmpty() const; private: - typedef std::pair<std::string, NotificationObserver*> ObserverRegistration; + typedef std::pair<std::string, content::NotificationObserver*> + ObserverRegistration; std::set<ObserverRegistration> observers_; PrefService* service_; diff --git a/chrome/browser/prefs/pref_change_registrar_unittest.cc b/chrome/browser/prefs/pref_change_registrar_unittest.cc index fdabfd9..3e5f192 100644 --- a/chrome/browser/prefs/pref_change_registrar_unittest.cc +++ b/chrome/browser/prefs/pref_change_registrar_unittest.cc @@ -4,10 +4,10 @@ #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/test/base/testing_pref_service.h" -#include "content/common/notification_details.h" -#include "content/common/notification_observer_mock.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/test/notification_observer_mock.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -22,8 +22,10 @@ class MockPrefService : public TestingPrefService { MockPrefService() {} virtual ~MockPrefService() {} - MOCK_METHOD2(AddPrefObserver, void(const char*, NotificationObserver*)); - MOCK_METHOD2(RemovePrefObserver, void(const char*, NotificationObserver*)); + MOCK_METHOD2(AddPrefObserver, + void(const char*, content::NotificationObserver*)); + MOCK_METHOD2(RemovePrefObserver, + void(const char*, content::NotificationObserver*)); }; } // namespace @@ -36,17 +38,17 @@ class PrefChangeRegistrarTest : public testing::Test { protected: virtual void SetUp(); - NotificationObserver* observer() const { return observer_.get(); } + content::NotificationObserver* observer() const { return observer_.get(); } MockPrefService* service() const { return service_.get(); } private: scoped_ptr<MockPrefService> service_; - scoped_ptr<NotificationObserverMock> observer_; + scoped_ptr<content::NotificationObserverMock> observer_; }; void PrefChangeRegistrarTest::SetUp() { service_.reset(new MockPrefService()); - observer_.reset(new NotificationObserverMock()); + observer_.reset(new content::NotificationObserverMock()); } TEST_F(PrefChangeRegistrarTest, AddAndRemove) { diff --git a/chrome/browser/prefs/pref_member.cc b/chrome/browser/prefs/pref_member.cc index a2c05b1..d700939 100644 --- a/chrome/browser/prefs/pref_member.cc +++ b/chrome/browser/prefs/pref_member.cc @@ -25,7 +25,7 @@ PrefMemberBase::~PrefMemberBase() { void PrefMemberBase::Init(const char* pref_name, PrefService* prefs, - NotificationObserver* observer) { + content::NotificationObserver* observer) { DCHECK(pref_name); DCHECK(prefs); DCHECK(pref_name_.empty()); // Check that Init is only called once. @@ -55,8 +55,8 @@ void PrefMemberBase::MoveToThread(BrowserThread::ID thread_id) { } void PrefMemberBase::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { VerifyValuePrefName(); DCHECK(chrome::NOTIFICATION_PREF_CHANGED == type); UpdateValueFromPref(); diff --git a/chrome/browser/prefs/pref_member.h b/chrome/browser/prefs/pref_member.h index 6c035ff..fa085e8 100644 --- a/chrome/browser/prefs/pref_member.h +++ b/chrome/browser/prefs/pref_member.h @@ -32,13 +32,13 @@ #include "base/memory/ref_counted.h" #include "base/values.h" #include "content/browser/browser_thread.h" -#include "content/common/notification_observer.h" +#include "content/public/browser/notification_observer.h" class PrefService; namespace subtle { -class PrefMemberBase : public NotificationObserver { +class PrefMemberBase : public content::NotificationObserver { protected: class Internal : public base::RefCountedThreadSafe<Internal> { public: @@ -82,7 +82,7 @@ class PrefMemberBase : public NotificationObserver { // See PrefMember<> for description. void Init(const char* pref_name, PrefService* prefs, - NotificationObserver* observer); + content::NotificationObserver* observer); virtual void CreateInternal() const = 0; @@ -91,10 +91,10 @@ class PrefMemberBase : public NotificationObserver { void MoveToThread(BrowserThread::ID thread_id); - // NotificationObserver + // content::NotificationObserver virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); void VerifyValuePrefName() const { DCHECK(!pref_name_.empty()); @@ -118,7 +118,7 @@ class PrefMemberBase : public NotificationObserver { // Ordered the members to compact the class instance. private: std::string pref_name_; - NotificationObserver* observer_; + content::NotificationObserver* observer_; PrefService* prefs_; protected: @@ -139,7 +139,7 @@ class PrefMember : public subtle::PrefMemberBase { // don't want any notifications of changes. // This method should only be called on the UI thread. void Init(const char* pref_name, PrefService* prefs, - NotificationObserver* observer) { + content::NotificationObserver* observer) { subtle::PrefMemberBase::Init(pref_name, prefs, observer); } diff --git a/chrome/browser/prefs/pref_member_unittest.cc b/chrome/browser/prefs/pref_member_unittest.cc index 332f45f..bb5080b 100644 --- a/chrome/browser/prefs/pref_member_unittest.cc +++ b/chrome/browser/prefs/pref_member_unittest.cc @@ -10,8 +10,8 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/testing_pref_service.h" #include "content/browser/browser_thread.h" -#include "content/common/notification_details.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -65,7 +65,7 @@ class GetPrefValueCallback bool value_; }; -class PrefMemberTestClass : public NotificationObserver { +class PrefMemberTestClass : public content::NotificationObserver { public: explicit PrefMemberTestClass(PrefService* prefs) : observe_cnt_(0), prefs_(prefs) { @@ -73,12 +73,12 @@ class PrefMemberTestClass : public NotificationObserver { } virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(chrome::NOTIFICATION_PREF_CHANGED == type); - PrefService* prefs_in = Source<PrefService>(source).ptr(); + PrefService* prefs_in = content::Source<PrefService>(source).ptr(); EXPECT_EQ(prefs_in, prefs_); - std::string* pref_name_in = Details<std::string>(details).ptr(); + std::string* pref_name_in = content::Details<std::string>(details).ptr(); EXPECT_EQ(*pref_name_in, kStringPref); EXPECT_EQ(str_.GetValue(), prefs_->GetString(kStringPref)); ++observe_cnt_; diff --git a/chrome/browser/prefs/pref_notifier_impl.cc b/chrome/browser/prefs/pref_notifier_impl.cc index 2dd454f..08a774f 100644 --- a/chrome/browser/prefs/pref_notifier_impl.cc +++ b/chrome/browser/prefs/pref_notifier_impl.cc @@ -7,7 +7,7 @@ #include "base/stl_util.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/chrome_notification_types.h" -#include "content/common/notification_observer.h" +#include "content/public/browser/notification_observer.h" #include "content/common/notification_service.h" PrefNotifierImpl::PrefNotifierImpl(PrefService* service) @@ -32,7 +32,7 @@ PrefNotifierImpl::~PrefNotifierImpl() { } void PrefNotifierImpl::AddPrefObserver(const char* path, - NotificationObserver* obs) { + content::NotificationObserver* obs) { // Get the pref observer list associated with the path. NotificationObserverList* observer_list = NULL; const PrefObserverMap::iterator observer_iterator = @@ -46,7 +46,7 @@ void PrefNotifierImpl::AddPrefObserver(const char* path, // Verify that this observer doesn't already exist. NotificationObserverList::Iterator it(*observer_list); - NotificationObserver* existing_obs; + content::NotificationObserver* existing_obs; while ((existing_obs = it.GetNext()) != NULL) { DCHECK(existing_obs != obs) << path << " observer already registered"; if (existing_obs == obs) @@ -58,7 +58,7 @@ void PrefNotifierImpl::AddPrefObserver(const char* path, } void PrefNotifierImpl::RemovePrefObserver(const char* path, - NotificationObserver* obs) { + content::NotificationObserver* obs) { DCHECK(CalledOnValidThread()); const PrefObserverMap::iterator observer_iterator = @@ -80,8 +80,8 @@ void PrefNotifierImpl::OnInitializationCompleted(bool succeeded) { NotificationService::current()->Notify( chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, - Source<PrefService>(pref_service_), - Details<bool>(&succeeded)); + content::Source<PrefService>(pref_service_), + content::Details<bool>(&succeeded)); } void PrefNotifierImpl::FireObservers(const std::string& path) { @@ -97,10 +97,10 @@ void PrefNotifierImpl::FireObservers(const std::string& path) { return; NotificationObserverList::Iterator it(*(observer_iterator->second)); - NotificationObserver* observer; + content::NotificationObserver* observer; while ((observer = it.GetNext()) != NULL) { observer->Observe(chrome::NOTIFICATION_PREF_CHANGED, - Source<PrefService>(pref_service_), - Details<const std::string>(&path)); + content::Source<PrefService>(pref_service_), + content::Details<const std::string>(&path)); } } diff --git a/chrome/browser/prefs/pref_notifier_impl.h b/chrome/browser/prefs/pref_notifier_impl.h index 8323fcb..b16ad11 100644 --- a/chrome/browser/prefs/pref_notifier_impl.h +++ b/chrome/browser/prefs/pref_notifier_impl.h @@ -14,7 +14,10 @@ #include "chrome/browser/prefs/pref_notifier.h" class PrefService; + +namespace content { class NotificationObserver; +} // The PrefNotifier implementation used by the PrefService. class PrefNotifierImpl : public PrefNotifier, @@ -25,8 +28,8 @@ class PrefNotifierImpl : public PrefNotifier, // If the pref at the given path changes, we call the observer's Observe // method with PREF_CHANGED. - void AddPrefObserver(const char* path, NotificationObserver* obs); - void RemovePrefObserver(const char* path, NotificationObserver* obs); + void AddPrefObserver(const char* path, content::NotificationObserver* obs); + void RemovePrefObserver(const char* path, content::NotificationObserver* obs); // PrefNotifier overrides. virtual void OnPreferenceChanged(const std::string& pref_name); @@ -36,7 +39,7 @@ class PrefNotifierImpl : public PrefNotifier, // A map from pref names to a list of observers. Observers get fired in the // order they are added. These should only be accessed externally for unit // testing. - typedef ObserverList<NotificationObserver> NotificationObserverList; + typedef ObserverList<content::NotificationObserver> NotificationObserverList; typedef base::hash_map<std::string, NotificationObserverList*> PrefObserverMap; diff --git a/chrome/browser/prefs/pref_notifier_impl_unittest.cc b/chrome/browser/prefs/pref_notifier_impl_unittest.cc index 1beb430c..8eb017c 100644 --- a/chrome/browser/prefs/pref_notifier_impl_unittest.cc +++ b/chrome/browser/prefs/pref_notifier_impl_unittest.cc @@ -8,9 +8,9 @@ #include "chrome/browser/prefs/pref_value_store.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/testing_pref_service.h" -#include "content/common/notification_observer_mock.h" -#include "content/common/notification_registrar.h" +#include "content/public/browser/notification_registrar.h" #include "content/common/notification_service.h" +#include "content/test/notification_observer_mock.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -34,7 +34,7 @@ class MockPrefNotifier : public PrefNotifierImpl { MOCK_METHOD1(FireObservers, void(const std::string& path)); - size_t CountObserver(const char* path, NotificationObserver* obs) { + size_t CountObserver(const char* path, content::NotificationObserver* obs) { PrefObserverMap::const_iterator observer_iterator = pref_observers()->find(path); if (observer_iterator == pref_observers()->end()) @@ -42,7 +42,7 @@ class MockPrefNotifier : public PrefNotifierImpl { NotificationObserverList* observer_list = observer_iterator->second; NotificationObserverList::Iterator it(*observer_list); - NotificationObserver* existing_obs; + content::NotificationObserver* existing_obs; size_t count = 0; while ((existing_obs = it.GetNext()) != NULL) { if (existing_obs == obs) @@ -79,14 +79,14 @@ TEST_F(PrefNotifierTest, OnPreferenceChanged) { TEST_F(PrefNotifierTest, OnInitializationCompleted) { MockPrefNotifier notifier(&pref_service_); - NotificationObserverMock observer; - NotificationRegistrar registrar; + content::NotificationObserverMock observer; + content::NotificationRegistrar registrar; registrar.Add(&observer, chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, - Source<PrefService>(&pref_service_)); + content::Source<PrefService>(&pref_service_)); EXPECT_CALL(observer, Observe( int(chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED), - Source<PrefService>(&pref_service_), - Property(&Details<bool>::ptr, testing::Pointee(true)))); + content::Source<PrefService>(&pref_service_), + Property(&content::Details<bool>::ptr, testing::Pointee(true)))); notifier.OnInitializationCompleted(true); } diff --git a/chrome/browser/prefs/pref_observer_mock.cc b/chrome/browser/prefs/pref_observer_mock.cc index 5d144b7..d42c69c 100644 --- a/chrome/browser/prefs/pref_observer_mock.cc +++ b/chrome/browser/prefs/pref_observer_mock.cc @@ -13,8 +13,8 @@ void PrefObserverMock::Expect(const PrefService* prefs, const std::string& pref_name, const Value* value) { EXPECT_CALL(*this, Observe(int(chrome::NOTIFICATION_PREF_CHANGED), - Source<PrefService>(prefs), - Property(&Details<std::string>::ptr, + content::Source<PrefService>(prefs), + Property(&content::Details<std::string>::ptr, Pointee(pref_name)))) .With(PrefValueMatches(prefs, pref_name, value)); } diff --git a/chrome/browser/prefs/pref_observer_mock.h b/chrome/browser/prefs/pref_observer_mock.h index d65d6b2..bc13ca3 100644 --- a/chrome/browser/prefs/pref_observer_mock.h +++ b/chrome/browser/prefs/pref_observer_mock.h @@ -9,9 +9,9 @@ #include <string> #include "chrome/browser/prefs/pref_service.h" -#include "content/common/notification_details.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "testing/gmock/include/gmock/gmock.h" @@ -37,14 +37,14 @@ MATCHER_P3(PrefValueMatches, prefs, pref_name, value, "") { } // A mock for testing preference notifications and easy setup of expectations. -class PrefObserverMock : public NotificationObserver { +class PrefObserverMock : public content::NotificationObserver { public: PrefObserverMock(); virtual ~PrefObserverMock(); MOCK_METHOD3(Observe, void(int type, - const NotificationSource& source, - const NotificationDetails& details)); + const content::NotificationSource& source, + const content::NotificationDetails& details)); void Expect(const PrefService* prefs, const std::string& pref_name, diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index c9bc91b..72b8452 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -690,12 +690,12 @@ const ListValue* PrefService::GetList(const char* path) const { } void PrefService::AddPrefObserver(const char* path, - NotificationObserver* obs) { + content::NotificationObserver* obs) { pref_notifier_->AddPrefObserver(path, obs); } void PrefService::RemovePrefObserver(const char* path, - NotificationObserver* obs) { + content::NotificationObserver* obs) { pref_notifier_->RemovePrefObserver(path, obs); } diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h index 5361928..3002e9d 100644 --- a/chrome/browser/prefs/pref_service.h +++ b/chrome/browser/prefs/pref_service.h @@ -19,7 +19,6 @@ class DefaultPrefStore; class FilePath; -class NotificationObserver; class PersistentPrefStore; class PrefModelAssociator; class PrefNotifier; @@ -29,6 +28,10 @@ class PrefValueStore; class Profile; class SyncableService; +namespace content { +class NotificationObserver; +} + namespace subtle { class PrefMemberBase; class ScopedUserPrefUpdateBase; @@ -348,8 +351,10 @@ class PrefService : public base::NonThreadSafe { // method with PREF_CHANGED. Note that observers should not call these methods // directly but rather use a PrefChangeRegistrar to make sure the observer // gets cleaned up properly. - virtual void AddPrefObserver(const char* path, NotificationObserver* obs); - virtual void RemovePrefObserver(const char* path, NotificationObserver* obs); + virtual void AddPrefObserver(const char* path, + content::NotificationObserver* obs); + virtual void RemovePrefObserver(const char* path, + content::NotificationObserver* obs); // Registers a new preference at |path|. The |default_value| must not be // NULL as it determines the preference value's type. diff --git a/chrome/browser/prefs/pref_set_observer.cc b/chrome/browser/prefs/pref_set_observer.cc index 80faf32..92b8fa6 100644 --- a/chrome/browser/prefs/pref_set_observer.cc +++ b/chrome/browser/prefs/pref_set_observer.cc @@ -8,7 +8,7 @@ #include "content/public/browser/notification_types.h" PrefSetObserver::PrefSetObserver(PrefService* pref_service, - NotificationObserver* observer) + content::NotificationObserver* observer) : pref_service_(pref_service), observer_(observer) { registrar_.Init(pref_service); @@ -45,7 +45,7 @@ bool PrefSetObserver::IsManaged() { // static PrefSetObserver* PrefSetObserver::CreateProxyPrefSetObserver( PrefService* pref_service, - NotificationObserver* observer) { + content::NotificationObserver* observer) { PrefSetObserver* pref_set = new PrefSetObserver(pref_service, observer); pref_set->AddPref(prefs::kProxy); @@ -55,7 +55,7 @@ PrefSetObserver* PrefSetObserver::CreateProxyPrefSetObserver( // static PrefSetObserver* PrefSetObserver::CreateDefaultSearchPrefSetObserver( PrefService* pref_service, - NotificationObserver* observer) { + content::NotificationObserver* observer) { PrefSetObserver* pref_set = new PrefSetObserver(pref_service, observer); pref_set->AddPref(prefs::kDefaultSearchProviderEnabled); pref_set->AddPref(prefs::kDefaultSearchProviderName); @@ -70,8 +70,8 @@ PrefSetObserver* PrefSetObserver::CreateDefaultSearchPrefSetObserver( } void PrefSetObserver::Observe(int type, - const NotificationSource& source, - const NotificationDetails& details) { + const content::NotificationSource& source, + const content::NotificationDetails& details) { if (observer_) observer_->Observe(type, source, details); } diff --git a/chrome/browser/prefs/pref_set_observer.h b/chrome/browser/prefs/pref_set_observer.h index 2639462..557bd83 100644 --- a/chrome/browser/prefs/pref_set_observer.h +++ b/chrome/browser/prefs/pref_set_observer.h @@ -11,15 +11,15 @@ #include "base/basictypes.h" #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/browser/prefs/pref_service.h" -#include "content/common/notification_observer.h" +#include "content/public/browser/notification_observer.h" // Observes the state of a set of preferences and allows to query their combined // managed bits. -class PrefSetObserver : public NotificationObserver { +class PrefSetObserver : public content::NotificationObserver { public: // Initialize with an empty set of preferences. PrefSetObserver(PrefService* pref_service, - NotificationObserver* observer); + content::NotificationObserver* observer); virtual ~PrefSetObserver(); // Add a |pref| to the set of preferences to observe. @@ -35,25 +35,25 @@ class PrefSetObserver : public NotificationObserver { // Create a pref set observer for all preferences relevant to proxies. static PrefSetObserver* CreateProxyPrefSetObserver( PrefService* pref_service, - NotificationObserver* observer); + content::NotificationObserver* observer); // Create a pref set observer for all preferences relevant to default search. static PrefSetObserver* CreateDefaultSearchPrefSetObserver( PrefService* pref_service, - NotificationObserver* observer); + content::NotificationObserver* observer); private: - // Overridden from NotificationObserver. + // Overridden from content::NotificationObserver. virtual void Observe(int type, - const NotificationSource& source, - const NotificationDetails& details); + const content::NotificationSource& source, + const content::NotificationDetails& details); typedef std::set<std::string> PrefSet; PrefSet prefs_; PrefService* pref_service_; PrefChangeRegistrar registrar_; - NotificationObserver* observer_; + content::NotificationObserver* observer_; DISALLOW_COPY_AND_ASSIGN(PrefSetObserver); }; diff --git a/chrome/browser/prefs/pref_set_observer_unittest.cc b/chrome/browser/prefs/pref_set_observer_unittest.cc index c3f7a12..e0aadf8 100644 --- a/chrome/browser/prefs/pref_set_observer_unittest.cc +++ b/chrome/browser/prefs/pref_set_observer_unittest.cc @@ -6,9 +6,9 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" -#include "content/common/notification_details.h" -#include "content/common/notification_observer_mock.h" -#include "content/common/notification_source.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" +#include "content/test/notification_observer_mock.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -28,7 +28,8 @@ class PrefSetObserverTest : public testing::Test { PrefService::UNSYNCABLE_PREF); } - PrefSetObserver* CreatePrefSetObserver(NotificationObserver* observer) { + PrefSetObserver* CreatePrefSetObserver( + content::NotificationObserver* observer) { PrefSetObserver* pref_set = new PrefSetObserver(pref_service_.get(), observer); pref_set->AddPref(prefs::kHomePage); @@ -62,7 +63,8 @@ TEST_F(PrefSetObserverTest, IsManaged) { } MATCHER_P(PrefNameDetails, name, "details references named preference") { - std::string* pstr = reinterpret_cast<const Details<std::string>&>(arg).ptr(); + std::string* pstr = + reinterpret_cast<const content::Details<std::string>&>(arg).ptr(); return pstr && *pstr == name; } @@ -70,12 +72,12 @@ TEST_F(PrefSetObserverTest, Observe) { using testing::_; using testing::Mock; - NotificationObserverMock observer; + content::NotificationObserverMock observer; scoped_ptr<PrefSetObserver> pref_set(CreatePrefSetObserver(&observer)); EXPECT_CALL(observer, Observe(int(chrome::NOTIFICATION_PREF_CHANGED), - Source<PrefService>(pref_service_.get()), + content::Source<PrefService>(pref_service_.get()), PrefNameDetails(prefs::kHomePage))); pref_service_->SetUserPref(prefs::kHomePage, Value::CreateStringValue("http://crbug.com")); @@ -83,7 +85,7 @@ TEST_F(PrefSetObserverTest, Observe) { EXPECT_CALL(observer, Observe(int(chrome::NOTIFICATION_PREF_CHANGED), - Source<PrefService>(pref_service_.get()), + content::Source<PrefService>(pref_service_.get()), PrefNameDetails(prefs::kHomePageIsNewTabPage))); pref_service_->SetUserPref(prefs::kHomePageIsNewTabPage, Value::CreateBooleanValue(true)); |