| 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 "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/invalidation/invalidation_service_util.h" | 10 #include "chrome/browser/invalidation/invalidation_service_util.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: { | 215 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: { |
| 216 // Transient error. Retry after some time. | 216 // Transient error. Retry after some time. |
| 217 request_access_token_backoff_.InformOfRequest(false); | 217 request_access_token_backoff_.InformOfRequest(false); |
| 218 request_access_token_retry_timer_.Start( | 218 request_access_token_retry_timer_.Start( |
| 219 FROM_HERE, | 219 FROM_HERE, |
| 220 request_access_token_backoff_.GetTimeUntilRelease(), | 220 request_access_token_backoff_.GetTimeUntilRelease(), |
| 221 base::Bind(&TiclInvalidationService::RequestAccessToken, | 221 base::Bind(&TiclInvalidationService::RequestAccessToken, |
| 222 base::Unretained(this))); | 222 base::Unretained(this))); |
| 223 break; | 223 break; |
| 224 } | 224 } |
| 225 case GoogleServiceAuthError::SERVICE_ERROR: |
| 225 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: { | 226 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: { |
| 226 // This is a real auth error. | 227 // This is a real auth error. |
| 227 // Report time since token was issued for invalid credentials error. | 228 // Report time since token was issued for invalid credentials error. |
| 228 base::Time auth_token_time = | 229 base::Time auth_token_time = |
| 229 AboutSigninInternalsFactory::GetForProfile(profile_)-> | 230 AboutSigninInternalsFactory::GetForProfile(profile_)-> |
| 230 GetTokenTime(GaiaConstants::kGaiaOAuth2LoginRefreshToken); | 231 GetTokenTime(GaiaConstants::kGaiaOAuth2LoginRefreshToken); |
| 231 if (!auth_token_time.is_null()) { | 232 if (!auth_token_time.is_null()) { |
| 232 base::TimeDelta age = base::Time::Now() - auth_token_time; | 233 base::TimeDelta age = base::Time::Now() - auth_token_time; |
| 233 if (age < base::TimeDelta::FromHours(1)) { | 234 if (age < base::TimeDelta::FromHours(1)) { |
| 234 UMA_HISTOGRAM_CUSTOM_TIMES( | 235 UMA_HISTOGRAM_CUSTOM_TIMES( |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 397 } |
| 397 | 398 |
| 398 // This service always expects to have a valid invalidator storage. | 399 // This service always expects to have a valid invalidator storage. |
| 399 // So we must not only clear the old one, but also start a new one. | 400 // So we must not only clear the old one, but also start a new one. |
| 400 invalidator_storage_->Clear(); | 401 invalidator_storage_->Clear(); |
| 401 invalidator_storage_.reset(new InvalidatorStorage(profile_->GetPrefs())); | 402 invalidator_storage_.reset(new InvalidatorStorage(profile_->GetPrefs())); |
| 402 invalidator_storage_->SetInvalidatorClientId(GenerateInvalidatorClientId()); | 403 invalidator_storage_->SetInvalidatorClientId(GenerateInvalidatorClientId()); |
| 403 } | 404 } |
| 404 | 405 |
| 405 } // namespace invalidation | 406 } // namespace invalidation |
| OLD | NEW |