| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sync/notifier/chrome_invalidation_client.h" | 5 #include "chrome/browser/sync/notifier/chrome_invalidation_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ChromeInvalidationClient::Invalidate( | 121 void ChromeInvalidationClient::Invalidate( |
| 122 const invalidation::Invalidation& invalidation, | 122 const invalidation::Invalidation& invalidation, |
| 123 invalidation::Closure* callback) { | 123 invalidation::Closure* callback) { |
| 124 DCHECK(non_thread_safe_.CalledOnValidThread()); | 124 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 125 DCHECK(invalidation::IsCallbackRepeatable(callback)); | 125 DCHECK(invalidation::IsCallbackRepeatable(callback)); |
| 126 VLOG(1) << "Invalidate: " << InvalidationToString(invalidation); | 126 VLOG(1) << "Invalidate: " << InvalidationToString(invalidation); |
| 127 syncable::ModelType model_type; | 127 syncable::ModelType model_type; |
| 128 if (ObjectIdToRealModelType(invalidation.object_id(), &model_type)) { | 128 if (ObjectIdToRealModelType(invalidation.object_id(), &model_type)) { |
| 129 std::string payload; |
| 130 // payload() CHECK()'s has_payload(), so we must check it ourselves first. |
| 131 if (invalidation.has_payload()) |
| 132 payload = invalidation.payload(); |
| 133 |
| 129 // TODO(akalin): This is a hack to make new sync data types work | 134 // TODO(akalin): This is a hack to make new sync data types work |
| 130 // with server-issued notifications. Remove this when it's not | 135 // with server-issued notifications. Remove this when it's not |
| 131 // needed anymore. | 136 // needed anymore. |
| 132 if (model_type == syncable::UNSPECIFIED) { | 137 if (model_type == syncable::UNSPECIFIED) { |
| 133 listener_->OnInvalidateAll(); | 138 listener_->OnInvalidateAll(); |
| 134 } else { | 139 } else { |
| 135 listener_->OnInvalidate(model_type); | 140 listener_->OnInvalidate(model_type, payload); |
| 136 } | 141 } |
| 137 } else { | 142 } else { |
| 138 LOG(WARNING) << "Could not get invalidation model type; " | 143 LOG(WARNING) << "Could not get invalidation model type; " |
| 139 << "invalidating everything"; | 144 << "invalidating everything"; |
| 140 listener_->OnInvalidateAll(); | 145 listener_->OnInvalidateAll(); |
| 141 } | 146 } |
| 142 RunAndDeleteClosure(callback); | 147 RunAndDeleteClosure(callback); |
| 143 } | 148 } |
| 144 | 149 |
| 145 void ChromeInvalidationClient::InvalidateAll( | 150 void ChromeInvalidationClient::InvalidateAll( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 214 |
| 210 void ChromeInvalidationClient::HandleOutboundPacket( | 215 void ChromeInvalidationClient::HandleOutboundPacket( |
| 211 invalidation::NetworkEndpoint* const& network_endpoint) { | 216 invalidation::NetworkEndpoint* const& network_endpoint) { |
| 212 DCHECK(non_thread_safe_.CalledOnValidThread()); | 217 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 213 CHECK(cache_invalidation_packet_handler_.get()); | 218 CHECK(cache_invalidation_packet_handler_.get()); |
| 214 cache_invalidation_packet_handler_-> | 219 cache_invalidation_packet_handler_-> |
| 215 HandleOutboundPacket(network_endpoint); | 220 HandleOutboundPacket(network_endpoint); |
| 216 } | 221 } |
| 217 | 222 |
| 218 } // namespace sync_notifier | 223 } // namespace sync_notifier |
| OLD | NEW |