Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/invalidation/ticl_invalidation_service.h" | 5 #include "chrome/browser/invalidation/ticl_invalidation_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/invalidation/invalidation_service_util.h" | 9 #include "chrome/browser/invalidation/invalidation_service_util.h" |
| 10 #include "chrome/browser/managed_mode/managed_user_service.h" | 10 #include "chrome/browser/managed_mode/managed_user_service.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 break; | 251 break; |
| 252 } | 252 } |
| 253 default: { | 253 default: { |
| 254 // We have no way to notify the user of this. Do nothing. | 254 // We have no way to notify the user of this. Do nothing. |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 void TiclInvalidationService::OnInvalidatorStateChange( | 259 void TiclInvalidationService::OnInvalidatorStateChange( |
| 260 syncer::InvalidatorState state) { | 260 syncer::InvalidatorState state) { |
| 261 invalidator_registrar_->UpdateInvalidatorState(state); | 261 if (state == syncer::INVALIDATION_CREDENTIALS_REJECTED) { |
| 262 // This might not be a real auth error. Our access tokens expire | |
|
tim (not reviewing)
2013/07/30 21:01:00
Maybe instead of "real", say "This may simply be
| |
| 263 // eventually. Sometimes all we need to do is fetch a fresh one. | |
| 264 RequestAccessToken(); | |
| 265 } else { | |
| 266 invalidator_registrar_->UpdateInvalidatorState(state); | |
| 267 } | |
| 262 } | 268 } |
| 263 | 269 |
| 264 void TiclInvalidationService::OnIncomingInvalidation( | 270 void TiclInvalidationService::OnIncomingInvalidation( |
| 265 const syncer::ObjectIdInvalidationMap& invalidation_map) { | 271 const syncer::ObjectIdInvalidationMap& invalidation_map) { |
| 266 invalidator_registrar_->DispatchInvalidationsToHandlers(invalidation_map); | 272 invalidator_registrar_->DispatchInvalidationsToHandlers(invalidation_map); |
| 267 } | 273 } |
| 268 | 274 |
| 269 void TiclInvalidationService::Shutdown() { | 275 void TiclInvalidationService::Shutdown() { |
| 270 DCHECK(CalledOnValidThread()); | 276 DCHECK(CalledOnValidThread()); |
| 271 if (IsStarted()) { | 277 if (IsStarted()) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 } | 370 } |
| 365 | 371 |
| 366 // This service always expects to have a valid invalidator storage. | 372 // This service always expects to have a valid invalidator storage. |
| 367 // So we must not only clear the old one, but also start a new one. | 373 // So we must not only clear the old one, but also start a new one. |
| 368 invalidator_storage_->Clear(); | 374 invalidator_storage_->Clear(); |
| 369 invalidator_storage_.reset(new InvalidatorStorage(profile_->GetPrefs())); | 375 invalidator_storage_.reset(new InvalidatorStorage(profile_->GetPrefs())); |
| 370 invalidator_storage_->SetInvalidatorClientId(GenerateInvalidatorClientId()); | 376 invalidator_storage_->SetInvalidatorClientId(GenerateInvalidatorClientId()); |
| 371 } | 377 } |
| 372 | 378 |
| 373 } // namespace invalidation | 379 } // namespace invalidation |
| OLD | NEW |