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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 UpdateRegistrations(); | 107 UpdateRegistrations(); |
108 } | 108 } |
109 | 109 |
110 void PushMessagingInvalidationHandler::OnInvalidatorStateChange( | 110 void PushMessagingInvalidationHandler::OnInvalidatorStateChange( |
111 syncer::InvalidatorState state) { | 111 syncer::InvalidatorState state) { |
112 DCHECK(thread_checker_.CalledOnValidThread()); | 112 DCHECK(thread_checker_.CalledOnValidThread()); |
113 // Nothing to do. | 113 // Nothing to do. |
114 } | 114 } |
115 | 115 |
116 void PushMessagingInvalidationHandler::OnIncomingInvalidation( | 116 void PushMessagingInvalidationHandler::OnIncomingInvalidation( |
117 const syncer::ObjectIdInvalidationMap& invalidation_map, | 117 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
118 syncer::IncomingInvalidationSource source) { | |
119 DCHECK(thread_checker_.CalledOnValidThread()); | 118 DCHECK(thread_checker_.CalledOnValidThread()); |
120 for (syncer::ObjectIdInvalidationMap::const_iterator it = | 119 for (syncer::ObjectIdInvalidationMap::const_iterator it = |
121 invalidation_map.begin(); it != invalidation_map.end(); ++it) { | 120 invalidation_map.begin(); it != invalidation_map.end(); ++it) { |
122 std::string extension_id; | 121 std::string extension_id; |
123 int subchannel; | 122 int subchannel; |
124 if (ObjectIdToExtensionAndSubchannel(it->first, | 123 if (ObjectIdToExtensionAndSubchannel(it->first, |
125 &extension_id, | 124 &extension_id, |
126 &subchannel)) { | 125 &subchannel)) { |
127 delegate_->OnMessage(extension_id, subchannel, it->second.payload); | 126 delegate_->OnMessage(extension_id, subchannel, it->second.payload); |
128 } | 127 } |
129 } | 128 } |
130 } | 129 } |
131 | 130 |
132 void PushMessagingInvalidationHandler::UpdateRegistrations() { | 131 void PushMessagingInvalidationHandler::UpdateRegistrations() { |
133 syncer::ObjectIdSet ids; | 132 syncer::ObjectIdSet ids; |
134 for (std::set<std::string>::const_iterator it = | 133 for (std::set<std::string>::const_iterator it = |
135 registered_extensions_.begin(); it != registered_extensions_.end(); | 134 registered_extensions_.begin(); it != registered_extensions_.end(); |
136 ++it) { | 135 ++it) { |
137 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); | 136 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); |
138 ids.insert(object_ids.begin(), object_ids.end()); | 137 ids.insert(object_ids.begin(), object_ids.end()); |
139 } | 138 } |
140 service_->UpdateRegisteredInvalidationIds(this, ids); | 139 service_->UpdateRegisteredInvalidationIds(this, ids); |
141 } | 140 } |
142 | 141 |
143 } // namespace extensions | 142 } // namespace extensions |
OLD | NEW |