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 "sync/notifier/chrome_invalidation_client.h" | 5 #include "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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 void ChromeInvalidationClient::UpdateCredentials( | 99 void ChromeInvalidationClient::UpdateCredentials( |
100 const std::string& email, const std::string& token) { | 100 const std::string& email, const std::string& token) { |
101 DCHECK(CalledOnValidThread()); | 101 DCHECK(CalledOnValidThread()); |
102 chrome_system_resources_.network()->UpdateCredentials(email, token); | 102 chrome_system_resources_.network()->UpdateCredentials(email, token); |
103 } | 103 } |
104 | 104 |
105 void ChromeInvalidationClient::RegisterTypes(syncable::ModelTypeSet types) { | 105 void ChromeInvalidationClient::RegisterTypes(syncable::ModelTypeSet types) { |
106 DCHECK(CalledOnValidThread()); | 106 DCHECK(CalledOnValidThread()); |
107 registered_types_ = types; | 107 registered_types_ = types; |
108 if (GetState() == NO_NOTIFICATION_ERROR && registration_manager_.get()) { | 108 // |ticl_state_| can go to NO_NOTIFICATION_ERROR even without a |
| 109 // working XMPP connection (as observed by us), so check it instead |
| 110 // of GetState() (see http://crbug.com/139424). |
| 111 if (ticl_state_ == NO_NOTIFICATION_ERROR && registration_manager_.get()) { |
109 registration_manager_->SetRegisteredTypes(registered_types_); | 112 registration_manager_->SetRegisteredTypes(registered_types_); |
110 } | 113 } |
111 // TODO(akalin): Clear invalidation versions for unregistered types. | 114 // TODO(akalin): Clear invalidation versions for unregistered types. |
112 } | 115 } |
113 | 116 |
114 void ChromeInvalidationClient::Ready( | 117 void ChromeInvalidationClient::Ready( |
115 invalidation::InvalidationClient* client) { | 118 invalidation::InvalidationClient* client) { |
116 ticl_state_ = NO_NOTIFICATION_ERROR; | 119 ticl_state_ = NO_NOTIFICATION_ERROR; |
117 EmitStateChange(); | 120 EmitStateChange(); |
118 registration_manager_->SetRegisteredTypes(registered_types_); | 121 registration_manager_->SetRegisteredTypes(registered_types_); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 EmitStateChange(); | 353 EmitStateChange(); |
351 } | 354 } |
352 | 355 |
353 void ChromeInvalidationClient::OnIncomingNotification( | 356 void ChromeInvalidationClient::OnIncomingNotification( |
354 const notifier::Notification& notification) { | 357 const notifier::Notification& notification) { |
355 DCHECK(CalledOnValidThread()); | 358 DCHECK(CalledOnValidThread()); |
356 // Do nothing, since this is already handled by |invalidation_client_|. | 359 // Do nothing, since this is already handled by |invalidation_client_|. |
357 } | 360 } |
358 | 361 |
359 } // namespace sync_notifier | 362 } // namespace sync_notifier |
OLD | NEW |