Chromium Code Reviews| Index: chrome/browser/chrome_to_mobile_service.cc |
| diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc |
| index b8cd66baea6e842840e2d76f993eb90f77341549..aaaa5b2da5fd543fa7d54f2b958c3dd530c40316 100644 |
| --- a/chrome/browser/chrome_to_mobile_service.cc |
| +++ b/chrome/browser/chrome_to_mobile_service.cc |
| @@ -184,7 +184,9 @@ ChromeToMobileService::ChromeToMobileService(Profile* profile) |
| CloudPrintURL cloud_print_url(profile_); |
| cloud_print_url_ = cloud_print_url.GetCloudPrintServiceURL(); |
| // Register for cloud print device list invalidation notifications. |
| - // TODO(msw|akalin): Initialize |sync_invalidation_enabled_| properly. |
| + sync_invalidation_enabled_ = |
|
msw
2012/09/06 00:43:48
nit: move above the "Register for cloud..." commen
akalin
2012/09/06 20:30:11
Done.
|
| + (profile_sync_service->GetInvalidatorState() == |
| + syncer::INVALIDATIONS_ENABLED); |
| profile_sync_service->RegisterInvalidationHandler(this); |
| syncer::ObjectIdSet ids; |
| ids.insert(invalidation::ObjectId( |
| @@ -354,27 +356,20 @@ void ChromeToMobileService::OnGetTokenFailure( |
| this, &ChromeToMobileService::RequestAccessToken); |
| } |
| -void ChromeToMobileService::OnNotificationsEnabled() { |
| - sync_invalidation_enabled_ = true; |
| +void ChromeToMobileService::OnInvalidatorStateChange( |
| + syncer::InvalidatorState state) { |
| + sync_invalidation_enabled_ = (state == syncer::INVALIDATIONS_ENABLED); |
| UpdateCommandState(); |
| } |
| -void ChromeToMobileService::OnNotificationsDisabled( |
| - syncer::NotificationsDisabledReason reason) { |
| - sync_invalidation_enabled_ = false; |
| - UpdateCommandState(); |
| -} |
| - |
| -void ChromeToMobileService::OnIncomingNotification( |
| +void ChromeToMobileService::OnIncomingInvalidation( |
| const syncer::ObjectIdStateMap& id_state_map, |
| - syncer::IncomingNotificationSource source) { |
| + syncer::IncomingInvalidationSource source) { |
| DCHECK_EQ(1U, id_state_map.size()); |
| DCHECK_EQ(1U, id_state_map.count(invalidation::ObjectId( |
| ipc::invalidation::ObjectSource::CHROME_COMPONENTS, |
| kSyncInvalidationObjectIdChromeToMobileDeviceList))); |
| RequestDeviceSearch(); |
| - // TODO(msw|akalin): This may not necessarily mean notifications are enabled. |
| - OnNotificationsEnabled(); |
| } |
| const std::string& ChromeToMobileService::GetAccessTokenForTest() const { |