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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 base::WeakPtr<RequestImpl> waiting_request) | 228 base::WeakPtr<RequestImpl> waiting_request) |
229 : oauth2_token_service_(oauth2_token_service), | 229 : oauth2_token_service_(oauth2_token_service), |
230 getter_(getter), | 230 getter_(getter), |
231 account_id_(account_id), | 231 account_id_(account_id), |
232 scopes_(scopes), | 232 scopes_(scopes), |
233 retry_number_(0), | 233 retry_number_(0), |
234 error_(GoogleServiceAuthError::SERVICE_UNAVAILABLE), | 234 error_(GoogleServiceAuthError::SERVICE_UNAVAILABLE), |
235 client_id_(client_id), | 235 client_id_(client_id), |
236 client_secret_(client_secret) { | 236 client_secret_(client_secret) { |
237 DCHECK(oauth2_token_service_); | 237 DCHECK(oauth2_token_service_); |
238 DCHECK(getter_.get()); | |
239 waiting_requests_.push_back(waiting_request); | 238 waiting_requests_.push_back(waiting_request); |
240 } | 239 } |
241 | 240 |
242 OAuth2TokenService::Fetcher::~Fetcher() { | 241 OAuth2TokenService::Fetcher::~Fetcher() { |
243 // Inform the waiting requests if it has not done so. | 242 // Inform the waiting requests if it has not done so. |
244 if (waiting_requests_.size()) | 243 if (waiting_requests_.size()) |
245 InformWaitingRequests(); | 244 InformWaitingRequests(); |
246 } | 245 } |
247 | 246 |
248 void OAuth2TokenService::Fetcher::Start() { | 247 void OAuth2TokenService::Fetcher::Start() { |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 const std::string& account_id, | 797 const std::string& account_id, |
799 const ScopeSet& scopes) const { | 798 const ScopeSet& scopes) const { |
800 PendingFetcherMap::const_iterator iter = pending_fetchers_.find( | 799 PendingFetcherMap::const_iterator iter = pending_fetchers_.find( |
801 OAuth2TokenService::RequestParameters( | 800 OAuth2TokenService::RequestParameters( |
802 client_id, | 801 client_id, |
803 account_id, | 802 account_id, |
804 scopes)); | 803 scopes)); |
805 return iter == pending_fetchers_.end() ? | 804 return iter == pending_fetchers_.end() ? |
806 0 : iter->second->GetWaitingRequestCount(); | 805 0 : iter->second->GetWaitingRequestCount(); |
807 } | 806 } |
OLD | NEW |