Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Unified Diff: chrome/browser/chrome_to_mobile_service.cc

Issue 10916131: [Invalidations] Add GetInvalidatorState() to Invalidator{,Frontend} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 96f096355ec3f62486fc11728e7d1d3e9027431b..0fa0e67e4783bce278a505f14bf83d827eedfe2c 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(
@@ -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 {

Powered by Google App Engine
This is Rietveld 408576698