| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/invalidation/ticl_invalidation_service.h" | 5 #include "components/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 "components/gcm_driver/gcm_driver.h" | 9 #include "components/gcm_driver/gcm_driver.h" |
| 10 #include "components/invalidation/gcm_invalidation_bridge.h" | 10 #include "components/invalidation/gcm_invalidation_bridge.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 if (access_token_request_ != NULL) | 186 if (access_token_request_ != NULL) |
| 187 return; | 187 return; |
| 188 request_access_token_retry_timer_.Stop(); | 188 request_access_token_retry_timer_.Stop(); |
| 189 OAuth2TokenService::ScopeSet oauth2_scopes; | 189 OAuth2TokenService::ScopeSet oauth2_scopes; |
| 190 for (size_t i = 0; i < arraysize(kOAuth2Scopes); i++) | 190 for (size_t i = 0; i < arraysize(kOAuth2Scopes); i++) |
| 191 oauth2_scopes.insert(kOAuth2Scopes[i]); | 191 oauth2_scopes.insert(kOAuth2Scopes[i]); |
| 192 // Invalidate previous token, otherwise token service will return the same | 192 // Invalidate previous token, otherwise token service will return the same |
| 193 // token again. | 193 // token again. |
| 194 const std::string& account_id = identity_provider_->GetActiveAccountId(); | 194 const std::string& account_id = identity_provider_->GetActiveAccountId(); |
| 195 OAuth2TokenService* token_service = identity_provider_->GetTokenService(); | 195 OAuth2TokenService* token_service = identity_provider_->GetTokenService(); |
| 196 token_service->InvalidateToken(account_id, oauth2_scopes, access_token_); | 196 token_service->InvalidateAccessToken(account_id, oauth2_scopes, |
| 197 access_token_); |
| 197 access_token_.clear(); | 198 access_token_.clear(); |
| 198 access_token_request_ = | 199 access_token_request_ = |
| 199 token_service->StartRequest(account_id, oauth2_scopes, this); | 200 token_service->StartRequest(account_id, oauth2_scopes, this); |
| 200 } | 201 } |
| 201 | 202 |
| 202 void TiclInvalidationService::OnGetTokenSuccess( | 203 void TiclInvalidationService::OnGetTokenSuccess( |
| 203 const OAuth2TokenService::Request* request, | 204 const OAuth2TokenService::Request* request, |
| 204 const std::string& access_token, | 205 const std::string& access_token, |
| 205 const base::Time& expiration_time) { | 206 const base::Time& expiration_time) { |
| 206 DCHECK_EQ(access_token_request_, request); | 207 DCHECK_EQ(access_token_request_, request); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } | 431 } |
| 431 | 432 |
| 432 void TiclInvalidationService::StopInvalidator() { | 433 void TiclInvalidationService::StopInvalidator() { |
| 433 DCHECK(invalidator_); | 434 DCHECK(invalidator_); |
| 434 gcm_invalidation_bridge_.reset(); | 435 gcm_invalidation_bridge_.reset(); |
| 435 invalidator_->UnregisterHandler(this); | 436 invalidator_->UnregisterHandler(this); |
| 436 invalidator_.reset(); | 437 invalidator_.reset(); |
| 437 } | 438 } |
| 438 | 439 |
| 439 } // namespace invalidation | 440 } // namespace invalidation |
| OLD | NEW |