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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.cc

Issue 10837214: Refactor ModelTypePayloadMap and ObjectIdPayloadMap to StateMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/api/push_messaging/push_messaging_invalidati on_handler.h" 5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Nothing to do. 119 // Nothing to do.
120 } 120 }
121 121
122 void PushMessagingInvalidationHandler::OnNotificationsDisabled( 122 void PushMessagingInvalidationHandler::OnNotificationsDisabled(
123 syncer::NotificationsDisabledReason reason) { 123 syncer::NotificationsDisabledReason reason) {
124 DCHECK(thread_checker_.CalledOnValidThread()); 124 DCHECK(thread_checker_.CalledOnValidThread());
125 // Nothing to do. 125 // Nothing to do.
126 } 126 }
127 127
128 void PushMessagingInvalidationHandler::OnIncomingNotification( 128 void PushMessagingInvalidationHandler::OnIncomingNotification(
129 const syncer::ObjectIdPayloadMap& id_payloads, 129 const syncer::ObjectIdStateMap& id_state_map,
130 syncer::IncomingNotificationSource source) { 130 syncer::IncomingNotificationSource source) {
131 DCHECK(thread_checker_.CalledOnValidThread()); 131 DCHECK(thread_checker_.CalledOnValidThread());
132 for (syncer::ObjectIdPayloadMap::const_iterator it = id_payloads.begin(); 132 for (syncer::ObjectIdStateMap::const_iterator it = id_state_map.begin();
133 it != id_payloads.end(); ++it) { 133 it != id_state_map.end(); ++it) {
134 std::string extension_id; 134 std::string extension_id;
135 int subchannel; 135 int subchannel;
136 if (ObjectIdToExtensionAndSubchannel(it->first, 136 if (ObjectIdToExtensionAndSubchannel(it->first,
137 &extension_id, 137 &extension_id,
138 &subchannel)) { 138 &subchannel)) {
139 delegate_->OnMessage(extension_id, subchannel, it->second); 139 delegate_->OnMessage(extension_id, subchannel, it->second.payload);
140 } 140 }
141 } 141 }
142 } 142 }
143 143
144 void PushMessagingInvalidationHandler::UpdateRegistrations() { 144 void PushMessagingInvalidationHandler::UpdateRegistrations() {
145 syncer::ObjectIdSet ids; 145 syncer::ObjectIdSet ids;
146 for (std::set<std::string>::const_iterator it = 146 for (std::set<std::string>::const_iterator it =
147 registered_extensions_.begin(); it != registered_extensions_.end(); 147 registered_extensions_.begin(); it != registered_extensions_.end();
148 ++it) { 148 ++it) {
149 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); 149 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it);
150 ids.insert(object_ids.begin(), object_ids.end()); 150 ids.insert(object_ids.begin(), object_ids.end());
151 } 151 }
152 service_->UpdateRegisteredInvalidationIds(this, ids); 152 service_->UpdateRegisteredInvalidationIds(this, ids);
153 } 153 }
154 154
155 } // namespace extensions 155 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698