Chromium Code Reviews| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 waiting_requests_.push_back(waiting_request); | 239 waiting_requests_.push_back(waiting_request); |
| 240 } | 240 } |
| 241 | 241 |
| 242 OAuth2TokenService::Fetcher::~Fetcher() { | 242 OAuth2TokenService::Fetcher::~Fetcher() { |
| 243 // Inform the waiting requests if it has not done so. | 243 // Inform the waiting requests if it has not done so. |
| 244 if (waiting_requests_.size()) | 244 if (waiting_requests_.size()) |
| 245 InformWaitingRequests(); | 245 InformWaitingRequests(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void OAuth2TokenService::Fetcher::Start() { | 248 void OAuth2TokenService::Fetcher::Start() { |
| 249 fetcher_.reset(new OAuth2AccessTokenFetcher(this, getter_.get())); | 249 fetcher_.reset(new OAuth2AccessTokenFetcherImpl(getter_.get())); |
| 250 fetcher_->Start(client_id_, | 250 fetcher_->Start(client_id_, |
| 251 client_secret_, | 251 client_secret_, |
| 252 refresh_token_, | 252 refresh_token_, |
| 253 std::vector<std::string>(scopes_.begin(), scopes_.end())); | 253 std::vector<std::string>(scopes_.begin(), scopes_.end()), |
| 254 this); | |
|
Roger Tawa OOO till Jul 10th
2014/03/03 21:24:44
Maybe define a virtual CreateAccessTokenFetcher()
msarda
2014/03/04 12:37:13
I plan to do that in a separate CL. Just to separa
| |
| 254 retry_timer_.Stop(); | 255 retry_timer_.Stop(); |
| 255 } | 256 } |
| 256 | 257 |
| 257 void OAuth2TokenService::Fetcher::OnGetTokenSuccess( | 258 void OAuth2TokenService::Fetcher::OnGetTokenSuccess( |
| 258 const std::string& access_token, | 259 const std::string& access_token, |
| 259 const base::Time& expiration_date) { | 260 const base::Time& expiration_date) { |
| 260 fetcher_.reset(); | 261 fetcher_.reset(); |
| 261 | 262 |
| 262 // Fetch completes. | 263 // Fetch completes. |
| 263 error_ = GoogleServiceAuthError::AuthErrorNone(); | 264 error_ = GoogleServiceAuthError::AuthErrorNone(); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 797 const std::string& account_id, | 798 const std::string& account_id, |
| 798 const ScopeSet& scopes) const { | 799 const ScopeSet& scopes) const { |
| 799 PendingFetcherMap::const_iterator iter = pending_fetchers_.find( | 800 PendingFetcherMap::const_iterator iter = pending_fetchers_.find( |
| 800 OAuth2TokenService::RequestParameters( | 801 OAuth2TokenService::RequestParameters( |
| 801 client_id, | 802 client_id, |
| 802 account_id, | 803 account_id, |
| 803 scopes)); | 804 scopes)); |
| 804 return iter == pending_fetchers_.end() ? | 805 return iter == pending_fetchers_.end() ? |
| 805 0 : iter->second->GetWaitingRequestCount(); | 806 0 : iter->second->GetWaitingRequestCount(); |
| 806 } | 807 } |
| OLD | NEW |