| 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 listener_->OnInvalidate(model_type); | 129 // TODO(akalin): This is a hack to make new sync data types work |
| 130 // with server-issued notifications. Remove this when it's not |
| 131 // needed anymore. |
| 132 if (model_type == syncable::UNSPECIFIED) { |
| 133 listener_->OnInvalidateAll(); |
| 134 } else { |
| 135 listener_->OnInvalidate(model_type); |
| 136 } |
| 130 } else { | 137 } else { |
| 131 LOG(WARNING) << "Could not get invalidation model type; " | 138 LOG(WARNING) << "Could not get invalidation model type; " |
| 132 << "invalidating everything"; | 139 << "invalidating everything"; |
| 133 listener_->OnInvalidateAll(); | 140 listener_->OnInvalidateAll(); |
| 134 } | 141 } |
| 135 RunAndDeleteClosure(callback); | 142 RunAndDeleteClosure(callback); |
| 136 } | 143 } |
| 137 | 144 |
| 138 void ChromeInvalidationClient::InvalidateAll( | 145 void ChromeInvalidationClient::InvalidateAll( |
| 139 invalidation::Closure* callback) { | 146 invalidation::Closure* callback) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 209 |
| 203 void ChromeInvalidationClient::HandleOutboundPacket( | 210 void ChromeInvalidationClient::HandleOutboundPacket( |
| 204 invalidation::NetworkEndpoint* const& network_endpoint) { | 211 invalidation::NetworkEndpoint* const& network_endpoint) { |
| 205 DCHECK(non_thread_safe_.CalledOnValidThread()); | 212 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 206 CHECK(cache_invalidation_packet_handler_.get()); | 213 CHECK(cache_invalidation_packet_handler_.get()); |
| 207 cache_invalidation_packet_handler_-> | 214 cache_invalidation_packet_handler_-> |
| 208 HandleOutboundPacket(network_endpoint); | 215 HandleOutboundPacket(network_endpoint); |
| 209 } | 216 } |
| 210 | 217 |
| 211 } // namespace sync_notifier | 218 } // namespace sync_notifier |
| OLD | NEW |