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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 void ChromeInvalidationClient::UpdateCredentials( | 97 void ChromeInvalidationClient::UpdateCredentials( |
98 const std::string& email, const std::string& token) { | 98 const std::string& email, const std::string& token) { |
99 DCHECK(CalledOnValidThread()); | 99 DCHECK(CalledOnValidThread()); |
100 chrome_system_resources_.network()->UpdateCredentials(email, token); | 100 chrome_system_resources_.network()->UpdateCredentials(email, token); |
101 } | 101 } |
102 | 102 |
103 void ChromeInvalidationClient::RegisterIds(const ObjectIdSet& ids) { | 103 void ChromeInvalidationClient::RegisterIds(const ObjectIdSet& ids) { |
104 DCHECK(CalledOnValidThread()); | 104 DCHECK(CalledOnValidThread()); |
105 registered_ids_ = ids; | 105 registered_ids_ = ids; |
106 if (GetState() == NO_NOTIFICATION_ERROR && registration_manager_.get()) { | 106 // |ticl_state_| can go to NO_NOTIFICATION_ERROR even without a |
| 107 // working XMPP connection (as observed by us), so check it instead |
| 108 // of GetState() (see http://crbug.com/139424). |
| 109 if (ticl_state_ == NO_NOTIFICATION_ERROR && registration_manager_.get()) { |
107 registration_manager_->SetRegisteredIds(registered_ids_); | 110 registration_manager_->SetRegisteredIds(registered_ids_); |
108 } | 111 } |
109 // TODO(akalin): Clear invalidation versions for unregistered types. | 112 // TODO(akalin): Clear invalidation versions for unregistered types. |
110 } | 113 } |
111 | 114 |
112 void ChromeInvalidationClient::Ready( | 115 void ChromeInvalidationClient::Ready( |
113 invalidation::InvalidationClient* client) { | 116 invalidation::InvalidationClient* client) { |
114 ticl_state_ = NO_NOTIFICATION_ERROR; | 117 ticl_state_ = NO_NOTIFICATION_ERROR; |
115 EmitStateChange(); | 118 EmitStateChange(); |
116 registration_manager_->SetRegisteredIds(registered_ids_); | 119 registration_manager_->SetRegisteredIds(registered_ids_); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 EmitStateChange(); | 332 EmitStateChange(); |
330 } | 333 } |
331 | 334 |
332 void ChromeInvalidationClient::OnIncomingNotification( | 335 void ChromeInvalidationClient::OnIncomingNotification( |
333 const notifier::Notification& notification) { | 336 const notifier::Notification& notification) { |
334 DCHECK(CalledOnValidThread()); | 337 DCHECK(CalledOnValidThread()); |
335 // Do nothing, since this is already handled by |invalidation_client_|. | 338 // Do nothing, since this is already handled by |invalidation_client_|. |
336 } | 339 } |
337 | 340 |
338 } // namespace syncer | 341 } // namespace syncer |
OLD | NEW |