Chromium Code Reviews| Index: chrome/browser/google_apis/drive_notification_manager.cc |
| diff --git a/chrome/browser/google_apis/drive_notification_manager.cc b/chrome/browser/google_apis/drive_notification_manager.cc |
| index b9744735591c69ba1b4754f9be81e08613844475..acc0691ebe144af2703b25fdb732dec11f72c973 100644 |
| --- a/chrome/browser/google_apis/drive_notification_manager.cc |
| +++ b/chrome/browser/google_apis/drive_notification_manager.cc |
| @@ -6,9 +6,9 @@ |
| #include "base/metrics/histogram.h" |
| #include "chrome/browser/google_apis/drive_notification_observer.h" |
| +#include "chrome/browser/invalidation/invalidation_service.h" |
| +#include "chrome/browser/invalidation/invalidation_service_factory.h" |
| #include "chrome/browser/profiles/profile.h" |
| -#include "chrome/browser/sync/profile_sync_service.h" |
| -#include "chrome/browser/sync/profile_sync_service_factory.h" |
| #include "google/cacheinvalidation/types.pb.h" |
| namespace google_apis { |
| @@ -42,15 +42,13 @@ DriveNotificationManager::~DriveNotificationManager() {} |
| void DriveNotificationManager::Shutdown() { |
| // Unregister for Drive notifications. |
| - ProfileSyncService* profile_sync_service = |
| - ProfileSyncServiceFactory::GetForProfile(profile_); |
| - if (!profile_sync_service || !push_notification_registered_) { |
| + invalidation::InvalidationService* invalidation_service = |
| + invalidation::InvalidationServiceFactory::GetForProfile(profile_); |
| + if (!invalidation_service || !push_notification_registered_) { |
| return; |
| } |
| - profile_sync_service->UpdateRegisteredInvalidationIds( |
|
rlarocque
2013/05/21 20:51:36
The API expects that clients will not unregister t
satorux1
2013/05/22 02:24:11
I'm a bit confused. Call to UpdateRegisteredInvali
rlarocque
2013/05/22 23:46:51
I agree, it does look strange. There's a valid re
satorux1
2013/05/23 00:54:21
Thank you for the explanation. Could you leave a s
rlarocque
2013/05/23 21:43:27
Done.
|
| - this, syncer::ObjectIdSet()); |
| - profile_sync_service->UnregisterInvalidationHandler(this); |
| + invalidation_service->UnregisterInvalidationHandler(this); |
| } |
| void DriveNotificationManager::OnInvalidatorStateChange( |
| @@ -76,9 +74,10 @@ void DriveNotificationManager::OnIncomingInvalidation( |
| // TODO(dcheng): Only acknowledge the invalidation once the fetch has |
| // completed. http://crbug.com/156843 |
| - ProfileSyncService* profile_sync_service = |
| - ProfileSyncServiceFactory::GetForProfile(profile_); |
| - profile_sync_service->AcknowledgeInvalidation( |
| + invalidation::InvalidationService* invalidation_service = |
| + invalidation::InvalidationServiceFactory::GetForProfile(profile_); |
| + CHECK(invalidation_service); |
|
satorux1
2013/05/22 02:24:11
DCHECK? I think we rarely use CHECK.
http://www.c
rlarocque
2013/05/22 23:46:51
Done.
|
| + invalidation_service->AcknowledgeInvalidation( |
| invalidation_map.begin()->first, |
| invalidation_map.begin()->second.ack_handle); |
| @@ -128,19 +127,19 @@ void DriveNotificationManager::NotifyObserversToUpdate( |
| void DriveNotificationManager::RegisterDriveNotifications() { |
| DCHECK(!push_notification_enabled_); |
| - ProfileSyncService* profile_sync_service = |
| - ProfileSyncServiceFactory::GetForProfile(profile_); |
| - if (!profile_sync_service) |
| + invalidation::InvalidationService* invalidation_service = |
| + invalidation::InvalidationServiceFactory::GetForProfile(profile_); |
| + if (!invalidation_service) |
| return; |
| - profile_sync_service->RegisterInvalidationHandler(this); |
| + invalidation_service->RegisterInvalidationHandler(this); |
| syncer::ObjectIdSet ids; |
| ids.insert(invalidation::ObjectId( |
| ipc::invalidation::ObjectSource::COSMO_CHANGELOG, |
| kDriveInvalidationObjectId)); |
| - profile_sync_service->UpdateRegisteredInvalidationIds(this, ids); |
| + invalidation_service->UpdateRegisteredInvalidationIds(this, ids); |
| push_notification_registered_ = true; |
| - OnInvalidatorStateChange(profile_sync_service->GetInvalidatorState()); |
| + OnInvalidatorStateChange(invalidation_service->GetInvalidatorState()); |
| UMA_HISTOGRAM_BOOLEAN("Drive.PushNotificationRegistered", |
| push_notification_registered_); |