diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-07 19:19:16 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-07 19:19:16 +0000 |
commit | 08a6f99997bad56869412e1da065acda3dc41538 (patch) | |
tree | cf28f8848aed5fa3f641e8f76380469500efa852 /chrome/browser/chrome_to_mobile_service.cc | |
parent | c12229d169345b5ea6fc69cfc4f23d57ac3a9fcc (diff) | |
download | chromium_src-08a6f99997bad56869412e1da065acda3dc41538.zip chromium_src-08a6f99997bad56869412e1da065acda3dc41538.tar.gz chromium_src-08a6f99997bad56869412e1da065acda3dc41538.tar.bz2 |
[Invalidations] Add GetInvalidatorState() to Invalidator{,Frontend}
Combine OnNotifications{Enabled,Disabled}() into OnInvalidatorStateChange(). Replace NotificationsDisabledReason with InvalidatorState.
Rename OnIncomingNotification to OnIncomingInvalidation. Also change
some references of "notification" to "invalidation".
Set the initial invalidator state in ChromeToMobileService. Also remove OnNotificationsEnabled() call from OnIncomingInvalidation().
Instantiate InvalidatorTest template for ProfileSyncService.
Move comments for invalidation-related functions from ProfileSyncService to InvalidatorFrontend.
Put DISALLOW_COPY_AND_ASSIGN on some classes.
Fix comment in invalidator.h.
BUG=142475
TBR=brettw@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10916131
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155448 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_to_mobile_service.cc')
-rw-r--r-- | chrome/browser/chrome_to_mobile_service.cc | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc index af269af..8e282ef 100644 --- a/chrome/browser/chrome_to_mobile_service.cc +++ b/chrome/browser/chrome_to_mobile_service.cc @@ -183,8 +183,10 @@ ChromeToMobileService::ChromeToMobileService(Profile* profile) if (profile_sync_service) { CloudPrintURL cloud_print_url(profile_); cloud_print_url_ = cloud_print_url.GetCloudPrintServiceURL(); + sync_invalidation_enabled_ = + (profile_sync_service->GetInvalidatorState() == + syncer::INVALIDATIONS_ENABLED); // Register for cloud print device list invalidation notifications. - // TODO(msw|akalin): Initialize |sync_invalidation_enabled_| properly. profile_sync_service->RegisterInvalidationHandler(this); syncer::ObjectIdSet ids; ids.insert(invalidation::ObjectId( @@ -363,27 +365,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 { |