OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "google_apis/gaia/oauth2_token_service.h" | 5 #include "google_apis/gaia/oauth2_token_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 void OAuth2TokenService::Fetcher::AddWaitingRequest( | 337 void OAuth2TokenService::Fetcher::AddWaitingRequest( |
338 base::WeakPtr<OAuth2TokenService::RequestImpl> waiting_request) { | 338 base::WeakPtr<OAuth2TokenService::RequestImpl> waiting_request) { |
339 waiting_requests_.push_back(waiting_request); | 339 waiting_requests_.push_back(waiting_request); |
340 } | 340 } |
341 | 341 |
342 size_t OAuth2TokenService::Fetcher::GetWaitingRequestCount() const { | 342 size_t OAuth2TokenService::Fetcher::GetWaitingRequestCount() const { |
343 return waiting_requests_.size(); | 343 return waiting_requests_.size(); |
344 } | 344 } |
345 | 345 |
346 void OAuth2TokenService::Fetcher::Cancel() { | 346 void OAuth2TokenService::Fetcher::Cancel() { |
| 347 if (fetcher_) |
| 348 fetcher_->CancelRequest(); |
347 fetcher_.reset(); | 349 fetcher_.reset(); |
348 retry_timer_.Stop(); | 350 retry_timer_.Stop(); |
349 error_ = GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED); | 351 error_ = GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED); |
350 InformWaitingRequestsAndDelete(); | 352 InformWaitingRequestsAndDelete(); |
351 } | 353 } |
352 | 354 |
353 const OAuth2TokenService::ScopeSet& OAuth2TokenService::Fetcher::GetScopeSet() | 355 const OAuth2TokenService::ScopeSet& OAuth2TokenService::Fetcher::GetScopeSet() |
354 const { | 356 const { |
355 return scopes_; | 357 return scopes_; |
356 } | 358 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 const std::string& account_id, | 799 const std::string& account_id, |
798 const ScopeSet& scopes) const { | 800 const ScopeSet& scopes) const { |
799 PendingFetcherMap::const_iterator iter = pending_fetchers_.find( | 801 PendingFetcherMap::const_iterator iter = pending_fetchers_.find( |
800 OAuth2TokenService::RequestParameters( | 802 OAuth2TokenService::RequestParameters( |
801 client_id, | 803 client_id, |
802 account_id, | 804 account_id, |
803 scopes)); | 805 scopes)); |
804 return iter == pending_fetchers_.end() ? | 806 return iter == pending_fetchers_.end() ? |
805 0 : iter->second->GetWaitingRequestCount(); | 807 0 : iter->second->GetWaitingRequestCount(); |
806 } | 808 } |
OLD | NEW |