Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 registered_types_ = types; | 111 registered_types_ = types; |
| 112 if (ticl_ready_ && registration_manager_.get()) { | 112 if (ticl_ready_ && registration_manager_.get()) { |
| 113 registration_manager_->SetRegisteredTypes(registered_types_); | 113 registration_manager_->SetRegisteredTypes(registered_types_); |
| 114 } | 114 } |
| 115 // TODO(akalin): Clear invalidation versions for unregistered types. | 115 // TODO(akalin): Clear invalidation versions for unregistered types. |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ChromeInvalidationClient::Ready( | 118 void ChromeInvalidationClient::Ready( |
| 119 invalidation::InvalidationClient* client) { | 119 invalidation::InvalidationClient* client) { |
| 120 ticl_ready_ = true; | 120 ticl_ready_ = true; |
| 121 listener_->OnSessionStatusChanged(true); | |
|
Nicolas Zea
2011/07/07 00:48:01
nit: style guide prefers an enum instead of bool f
| |
| 121 registration_manager_->SetRegisteredTypes(registered_types_); | 122 registration_manager_->SetRegisteredTypes(registered_types_); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void ChromeInvalidationClient::Invalidate( | 125 void ChromeInvalidationClient::Invalidate( |
| 125 invalidation::InvalidationClient* client, | 126 invalidation::InvalidationClient* client, |
| 126 const invalidation::Invalidation& invalidation, | 127 const invalidation::Invalidation& invalidation, |
| 127 const invalidation::AckHandle& ack_handle) { | 128 const invalidation::AckHandle& ack_handle) { |
| 128 DCHECK(non_thread_safe_.CalledOnValidThread()); | 129 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 129 VLOG(1) << "Invalidate: " << InvalidationToString(invalidation); | 130 VLOG(1) << "Invalidate: " << InvalidationToString(invalidation); |
| 130 syncable::ModelType model_type; | 131 syncable::ModelType model_type; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 const std::string& prefix, | 264 const std::string& prefix, |
| 264 int prefix_length) { | 265 int prefix_length) { |
| 265 DCHECK(non_thread_safe_.CalledOnValidThread()); | 266 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 266 VLOG(1) << "AllRegistrationsLost"; | 267 VLOG(1) << "AllRegistrationsLost"; |
| 267 registration_manager_->MarkAllRegistrationsLost(); | 268 registration_manager_->MarkAllRegistrationsLost(); |
| 268 } | 269 } |
| 269 | 270 |
| 270 void ChromeInvalidationClient::InformError( | 271 void ChromeInvalidationClient::InformError( |
| 271 invalidation::InvalidationClient* client, | 272 invalidation::InvalidationClient* client, |
| 272 const invalidation::ErrorInfo& error_info) { | 273 const invalidation::ErrorInfo& error_info) { |
| 274 listener_->OnSessionStatusChanged(false); | |
| 275 LOG(ERROR) << "Invalidation client encountered an error"; | |
| 273 // TODO(ghc): handle the error. | 276 // TODO(ghc): handle the error. |
| 274 } | 277 } |
| 275 | 278 |
| 276 void ChromeInvalidationClient::WriteState(const std::string& state) { | 279 void ChromeInvalidationClient::WriteState(const std::string& state) { |
| 277 DCHECK(non_thread_safe_.CalledOnValidThread()); | 280 DCHECK(non_thread_safe_.CalledOnValidThread()); |
| 278 CHECK(state_writer_); | 281 CHECK(state_writer_); |
| 279 state_writer_->WriteState(state); | 282 state_writer_->WriteState(state); |
| 280 } | 283 } |
| 281 | 284 |
| 282 } // namespace sync_notifier | 285 } // namespace sync_notifier |
| OLD | NEW |