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

Side by Side Diff: chrome/browser/drive/drive_notification_manager.cc

Issue 23441042: Refactor common invalidation framework types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move DEPS rule Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/push_messaging/push_messaging_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/drive/drive_notification_manager.h" 5 #include "chrome/browser/drive/drive_notification_manager.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/drive/drive_notification_observer.h" 8 #include "chrome/browser/drive/drive_notification_observer.h"
9 #include "chrome/browser/invalidation/invalidation_service.h" 9 #include "chrome/browser/invalidation/invalidation_service.h"
10 #include "chrome/browser/invalidation/invalidation_service_factory.h" 10 #include "chrome/browser/invalidation/invalidation_service_factory.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } else { 61 } else {
62 DVLOG(1) << "XMPP Notifications disabled (state=" << state << ")"; 62 DVLOG(1) << "XMPP Notifications disabled (state=" << state << ")";
63 } 63 }
64 FOR_EACH_OBSERVER(DriveNotificationObserver, observers_, 64 FOR_EACH_OBSERVER(DriveNotificationObserver, observers_,
65 OnPushNotificationEnabled(push_notification_enabled_)); 65 OnPushNotificationEnabled(push_notification_enabled_));
66 } 66 }
67 67
68 void DriveNotificationManager::OnIncomingInvalidation( 68 void DriveNotificationManager::OnIncomingInvalidation(
69 const syncer::ObjectIdInvalidationMap& invalidation_map) { 69 const syncer::ObjectIdInvalidationMap& invalidation_map) {
70 DVLOG(2) << "XMPP Drive Notification Received"; 70 DVLOG(2) << "XMPP Drive Notification Received";
71 DCHECK_EQ(1U, invalidation_map.size()); 71 syncer::ObjectIdSet ids = invalidation_map.GetObjectIds();
72 DCHECK_EQ(1U, ids.size());
72 const invalidation::ObjectId object_id( 73 const invalidation::ObjectId object_id(
73 ipc::invalidation::ObjectSource::COSMO_CHANGELOG, 74 ipc::invalidation::ObjectSource::COSMO_CHANGELOG,
74 kDriveInvalidationObjectId); 75 kDriveInvalidationObjectId);
75 DCHECK_EQ(1U, invalidation_map.count(object_id)); 76 DCHECK_EQ(1U, ids.count(object_id));
76 77
77 // TODO(dcheng): Only acknowledge the invalidation once the fetch has 78 // TODO(dcheng): Only acknowledge the invalidation once the fetch has
78 // completed. http://crbug.com/156843 79 // completed. http://crbug.com/156843
79 DCHECK(invalidation_service_); 80 DCHECK(invalidation_service_);
80 invalidation_service_->AcknowledgeInvalidation( 81 syncer::Invalidation inv = invalidation_map.ForObject(object_id).back();
81 invalidation_map.begin()->first, 82 invalidation_service_->AcknowledgeInvalidation(object_id, inv.ack_handle());
82 invalidation_map.begin()->second.ack_handle);
83 83
84 NotifyObserversToUpdate(NOTIFICATION_XMPP); 84 NotifyObserversToUpdate(NOTIFICATION_XMPP);
85 } 85 }
86 86
87 void DriveNotificationManager::AddObserver( 87 void DriveNotificationManager::AddObserver(
88 DriveNotificationObserver* observer) { 88 DriveNotificationObserver* observer) {
89 observers_.AddObserver(observer); 89 observers_.AddObserver(observer);
90 } 90 }
91 91
92 void DriveNotificationManager::RemoveObserver( 92 void DriveNotificationManager::RemoveObserver(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return "NOTIFICATION_XMPP"; 151 return "NOTIFICATION_XMPP";
152 case NOTIFICATION_POLLING: 152 case NOTIFICATION_POLLING:
153 return "NOTIFICATION_POLLING"; 153 return "NOTIFICATION_POLLING";
154 } 154 }
155 155
156 NOTREACHED(); 156 NOTREACHED();
157 return ""; 157 return "";
158 } 158 }
159 159
160 } // namespace drive 160 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/push_messaging/push_messaging_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698