| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 UpdateRegistrations(); | 112 UpdateRegistrations(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void PushMessagingInvalidationHandler::OnInvalidatorStateChange( | 115 void PushMessagingInvalidationHandler::OnInvalidatorStateChange( |
| 116 syncer::InvalidatorState state) { | 116 syncer::InvalidatorState state) { |
| 117 DCHECK(thread_checker_.CalledOnValidThread()); | 117 DCHECK(thread_checker_.CalledOnValidThread()); |
| 118 // Nothing to do. | 118 // Nothing to do. |
| 119 } | 119 } |
| 120 | 120 |
| 121 void PushMessagingInvalidationHandler::OnIncomingInvalidation( | 121 void PushMessagingInvalidationHandler::OnIncomingInvalidation( |
| 122 const syncer::ObjectIdStateMap& id_state_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::ObjectIdStateMap::const_iterator it = id_state_map.begin(); | 125 for (syncer::ObjectIdInvalidationMap::const_iterator it = |
| 126 it != id_state_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); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 void PushMessagingInvalidationHandler::UpdateRegistrations() { | 137 void PushMessagingInvalidationHandler::UpdateRegistrations() { |
| 138 syncer::ObjectIdSet ids; | 138 syncer::ObjectIdSet ids; |
| 139 for (std::set<std::string>::const_iterator it = | 139 for (std::set<std::string>::const_iterator it = |
| 140 registered_extensions_.begin(); it != registered_extensions_.end(); | 140 registered_extensions_.begin(); it != registered_extensions_.end(); |
| 141 ++it) { | 141 ++it) { |
| 142 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); | 142 const syncer::ObjectIdSet& object_ids = ExtensionIdToObjectIds(*it); |
| 143 ids.insert(object_ids.begin(), object_ids.end()); | 143 ids.insert(object_ids.begin(), object_ids.end()); |
| 144 } | 144 } |
| 145 service_->UpdateRegisteredInvalidationIds(this, ids); | 145 service_->UpdateRegisteredInvalidationIds(this, ids); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace extensions | 148 } // namespace extensions |
| OLD | NEW |