diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/dom_ui/sync_options_handler.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/glue/data_type_manager_impl.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/glue/data_type_manager_mock.h | 17 | ||||
-rw-r--r-- | chrome/browser/sync/glue/sync_backend_host.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 28 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service_startup_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/common/notification_type.h | 8 |
7 files changed, 42 insertions, 29 deletions
diff --git a/chrome/browser/dom_ui/sync_options_handler.cc b/chrome/browser/dom_ui/sync_options_handler.cc index a8798bb..ec6a233 100644 --- a/chrome/browser/dom_ui/sync_options_handler.cc +++ b/chrome/browser/dom_ui/sync_options_handler.cc @@ -68,6 +68,6 @@ void SyncOptionsHandler::RegisterMessages() { void SyncOptionsHandler::OnPreferredDataTypesUpdated(const ListValue* args) { NotificationService::current()->Notify( NotificationType::SYNC_DATA_TYPES_UPDATED, - NotificationService::AllSources(), + Source<Profile>(dom_ui_->GetProfile()), NotificationService::NoDetails()); } diff --git a/chrome/browser/sync/glue/data_type_manager_impl.cc b/chrome/browser/sync/glue/data_type_manager_impl.cc index d170ec3..2266a3f 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl.cc @@ -412,14 +412,14 @@ void DataTypeManagerImpl::RemoveObserver(NotificationType type) { void DataTypeManagerImpl::NotifyStart() { NotificationService::current()->Notify( NotificationType::SYNC_CONFIGURE_START, - NotificationService::AllSources(), + Source<DataTypeManager>(this), NotificationService::NoDetails()); } void DataTypeManagerImpl::NotifyDone(ConfigureResult result) { NotificationService::current()->Notify( NotificationType::SYNC_CONFIGURE_DONE, - NotificationService::AllSources(), + Source<DataTypeManager>(this), Details<ConfigureResult>(&result)); } diff --git a/chrome/browser/sync/glue/data_type_manager_mock.h b/chrome/browser/sync/glue/data_type_manager_mock.h index ce61e27..2a1705a 100644 --- a/chrome/browser/sync/glue/data_type_manager_mock.h +++ b/chrome/browser/sync/glue/data_type_manager_mock.h @@ -13,13 +13,19 @@ #include "chrome/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" -ACTION_P2(NotifyWithResult, type, result) { +ACTION_P3(NotifyFromDataTypeManagerWithResult, dtm, type, result) { NotificationService::current()->Notify( type, - NotificationService::AllSources(), + Source<browser_sync::DataTypeManager>(dtm), Details<browser_sync::DataTypeManager::ConfigureResult>(result)); } +ACTION_P2(NotifyFromDataTypeManager, dtm, type) { + NotificationService::current()->Notify(type, + Source<browser_sync::DataTypeManager>(dtm), + NotificationService::NoDetails()); +} + namespace browser_sync { class DataTypeManagerMock : public DataTypeManager { @@ -30,9 +36,10 @@ class DataTypeManagerMock : public DataTypeManager { // detail. ON_CALL(*this, Configure(testing::_)). WillByDefault(testing::DoAll( - Notify(NotificationType::SYNC_CONFIGURE_START), - NotifyWithResult(NotificationType::SYNC_CONFIGURE_DONE, - &result_))); + NotifyFromDataTypeManager(this, + NotificationType::SYNC_CONFIGURE_START), + NotifyFromDataTypeManagerWithResult + (this, NotificationType::SYNC_CONFIGURE_DONE, &result_))); } MOCK_METHOD1(Configure, void(const TypeSet&)); diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 56c8b86..1df0905 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -337,7 +337,7 @@ void SyncBackendHost::Core::NotifyResumed() { void SyncBackendHost::Core::NotifyPassphraseRequired() { NotificationService::current()->Notify( NotificationType::SYNC_PASSPHRASE_REQUIRED, - NotificationService::AllSources(), + Source<SyncBackendHost>(host_), NotificationService::NoDetails()); } @@ -346,7 +346,7 @@ void SyncBackendHost::Core::NotifyPassphraseAccepted( host_->PersistEncryptionBootstrapToken(bootstrap_token); NotificationService::current()->Notify( NotificationType::SYNC_PASSPHRASE_ACCEPTED, - NotificationService::AllSources(), + Source<SyncBackendHost>(host_), NotificationService::NoDetails()); } diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 1196647..b049dd8 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -75,20 +75,8 @@ ProfileSyncService::ProfileSyncService(ProfileSyncFactory* factory, DCHECK(factory); DCHECK(profile); registrar_.Add(this, - NotificationType::SYNC_CONFIGURE_START, - NotificationService::AllSources()); - registrar_.Add(this, - NotificationType::SYNC_CONFIGURE_DONE, - NotificationService::AllSources()); - registrar_.Add(this, NotificationType::SYNC_DATA_TYPES_UPDATED, - NotificationService::AllSources()); - registrar_.Add(this, - NotificationType::SYNC_PASSPHRASE_REQUIRED, - NotificationService::AllSources()); - registrar_.Add(this, - NotificationType::SYNC_PASSPHRASE_ACCEPTED, - NotificationService::AllSources()); + Source<Profile>(profile)); // By default, dev & chromium users will go to the development servers. // Dev servers have more features than standard sync servers. @@ -401,6 +389,14 @@ void ProfileSyncService::StartUp() { profile_->GetPrefs()->GetInt64(prefs::kSyncLastSyncedTime)); CreateBackend(); + + registrar_.Add(this, + NotificationType::SYNC_PASSPHRASE_REQUIRED, + Source<SyncBackendHost>(backend_.get())); + registrar_.Add(this, + NotificationType::SYNC_PASSPHRASE_ACCEPTED, + Source<SyncBackendHost>(backend_.get())); + // Initialize the backend. Every time we start up a new SyncBackendHost, // we'll want to start from a fresh SyncDB, so delete any old one that might // be there. @@ -824,6 +820,12 @@ void ProfileSyncService::ConfigureDataTypeManager() { data_type_manager_.reset( factory_->CreateDataTypeManager(backend_.get(), data_type_controllers_)); + registrar_.Add(this, + NotificationType::SYNC_CONFIGURE_START, + Source<DataTypeManager>(data_type_manager_.get())); + registrar_.Add(this, + NotificationType::SYNC_CONFIGURE_DONE, + Source<DataTypeManager>(data_type_manager_.get())); } syncable::ModelTypeSet types; diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index e831e36..e7e1a34 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -175,9 +175,11 @@ TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(StartFailure)) { DataTypeManager::ConfigureResult result = DataTypeManager::ASSOCIATION_FAILED; EXPECT_CALL(*data_type_manager, Configure(_)). - WillOnce(DoAll(Notify(NotificationType::SYNC_CONFIGURE_START), - NotifyWithResult(NotificationType::SYNC_CONFIGURE_DONE, - &result))); + WillOnce(DoAll(NotifyFromDataTypeManager(data_type_manager, + NotificationType::SYNC_CONFIGURE_START), + NotifyFromDataTypeManagerWithResult(data_type_manager, + NotificationType::SYNC_CONFIGURE_DONE, + &result))); EXPECT_CALL(*data_type_manager, state()). WillOnce(Return(DataTypeManager::STOPPED)); diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index f502a00..167ca6c 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -1042,17 +1042,19 @@ class NotificationType { // The syncer requires a passphrase to decrypt sensitive updates. This // notification is sent when the first sensitive data type is setup by the // user as well as anytime any the passphrase is changed in another synced - // client. + // client. The source is the SyncBackendHost wanting a passphrase. No + // details. SYNC_PASSPHRASE_REQUIRED, // Sent when the passphrase provided by the user is accepted. After this // notification is sent, updates to sensitive nodes are encrypted using the - // accepted passphrase. + // accepted passphrase. The source is the SyncBackendHost that accepted + // the passphrase. No details. SYNC_PASSPHRASE_ACCEPTED, // Sent when the set of data types that should be synced has been modified // externally (eg. by the dom_ui options screen). - // There are no source or details for this notification. + // The source is the Profile, there are no details. SYNC_DATA_TYPES_UPDATED, // Cookies ----------------------------------------------------------------- |