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