OLD | NEW |
---|---|
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 const syncer::ObjectIdInvalidationMap& invalidation_map, | 122 const syncer::ObjectIdInvalidationMap& invalidation_map, |
123 syncer::IncomingInvalidationSource source) { | 123 syncer::IncomingInvalidationSource source) { |
124 DCHECK(thread_checker_.CalledOnValidThread()); | 124 DCHECK(thread_checker_.CalledOnValidThread()); |
125 for (syncer::ObjectIdInvalidationMap::const_iterator it = | 125 for (syncer::ObjectIdInvalidationMap::const_iterator it = |
126 invalidation_map.begin(); it != invalidation_map.end(); ++it) { | 126 invalidation_map.begin(); it != invalidation_map.end(); ++it) { |
127 std::string extension_id; | 127 std::string extension_id; |
128 int subchannel; | 128 int subchannel; |
129 if (ObjectIdToExtensionAndSubchannel(it->first, | 129 if (ObjectIdToExtensionAndSubchannel(it->first, |
130 &extension_id, | 130 &extension_id, |
131 &subchannel)) { | 131 &subchannel)) { |
132 delegate_->OnMessage(extension_id, subchannel, it->second.payload); | 132 delegate_->OnMessage(extension_id, subchannel, it->second.payload); |
akalin
2012/10/19 13:27:16
Question: Is this synchronous? i.e., can we ack i
dcheng
2012/10/19 19:38:11
Doing this properly is somewhat harder, as this in
| |
133 } | 133 } |
134 service_->AcknowledgeInvalidation(it->first, it->second.ack_handle); | |
134 } | 135 } |
135 } | 136 } |
136 | 137 |
137 void PushMessagingInvalidationHandler::UpdateRegistrations() { | 138 void PushMessagingInvalidationHandler::UpdateRegistrations() { |
138 syncer::ObjectIdSet ids; | 139 syncer::ObjectIdSet ids; |
139 for (std::set<std::string>::const_iterator it = | 140 for (std::set<std::string>::const_iterator it = |
140 registered_extensions_.begin(); it != registered_extensions_.end(); | 141 registered_extensions_.begin(); it != registered_extensions_.end(); |
141 ++it) { | 142 ++it) { |
142 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); | 143 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); |
143 ids.insert(object_ids.begin(), object_ids.end()); | 144 ids.insert(object_ids.begin(), object_ids.end()); |
144 } | 145 } |
145 service_->UpdateRegisteredInvalidationIds(this, ids); | 146 service_->UpdateRegisteredInvalidationIds(this, ids); |
146 } | 147 } |
147 | 148 |
148 } // namespace extensions | 149 } // namespace extensions |
OLD | NEW |