| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 381 |
| 382 OAuth2TokenService::Request::~Request() { | 382 OAuth2TokenService::Request::~Request() { |
| 383 } | 383 } |
| 384 | 384 |
| 385 OAuth2TokenService::Consumer::Consumer(const std::string& id) | 385 OAuth2TokenService::Consumer::Consumer(const std::string& id) |
| 386 : id_(id) {} | 386 : id_(id) {} |
| 387 | 387 |
| 388 OAuth2TokenService::Consumer::~Consumer() { | 388 OAuth2TokenService::Consumer::~Consumer() { |
| 389 } | 389 } |
| 390 | 390 |
| 391 OAuth2TokenService::OAuth2TokenService(OAuth2TokenServiceDelegate* delegate) | 391 OAuth2TokenService::OAuth2TokenService( |
| 392 : delegate_(delegate) { | 392 std::unique_ptr<OAuth2TokenServiceDelegate> delegate) |
| 393 : delegate_(std::move(delegate)) { |
| 393 DCHECK(delegate_); | 394 DCHECK(delegate_); |
| 394 } | 395 } |
| 395 | 396 |
| 396 OAuth2TokenService::~OAuth2TokenService() { | 397 OAuth2TokenService::~OAuth2TokenService() { |
| 397 // Release all the pending fetchers. | 398 // Release all the pending fetchers. |
| 398 pending_fetchers_.clear(); | 399 pending_fetchers_.clear(); |
| 399 } | 400 } |
| 400 | 401 |
| 401 OAuth2TokenServiceDelegate* OAuth2TokenService::GetDelegate() { | 402 OAuth2TokenServiceDelegate* OAuth2TokenService::GetDelegate() { |
| 402 return delegate_.get(); | 403 return delegate_.get(); |
| 403 } | 404 } |
| 404 | 405 |
| 406 const OAuth2TokenServiceDelegate* OAuth2TokenService::GetDelegate() const { |
| 407 return delegate_.get(); |
| 408 } |
| 409 |
| 405 void OAuth2TokenService::AddObserver(Observer* observer) { | 410 void OAuth2TokenService::AddObserver(Observer* observer) { |
| 406 delegate_->AddObserver(observer); | 411 delegate_->AddObserver(observer); |
| 407 } | 412 } |
| 408 | 413 |
| 409 void OAuth2TokenService::RemoveObserver(Observer* observer) { | 414 void OAuth2TokenService::RemoveObserver(Observer* observer) { |
| 410 delegate_->RemoveObserver(observer); | 415 delegate_->RemoveObserver(observer); |
| 411 } | 416 } |
| 412 | 417 |
| 413 void OAuth2TokenService::AddDiagnosticsObserver(DiagnosticsObserver* observer) { | 418 void OAuth2TokenService::AddDiagnosticsObserver(DiagnosticsObserver* observer) { |
| 414 diagnostics_observer_list_.AddObserver(observer); | 419 diagnostics_observer_list_.AddObserver(observer); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 817 |
| 813 size_t OAuth2TokenService::GetNumPendingRequestsForTesting( | 818 size_t OAuth2TokenService::GetNumPendingRequestsForTesting( |
| 814 const std::string& client_id, | 819 const std::string& client_id, |
| 815 const std::string& account_id, | 820 const std::string& account_id, |
| 816 const ScopeSet& scopes) const { | 821 const ScopeSet& scopes) const { |
| 817 auto iter = pending_fetchers_.find( | 822 auto iter = pending_fetchers_.find( |
| 818 OAuth2TokenService::RequestParameters(client_id, account_id, scopes)); | 823 OAuth2TokenService::RequestParameters(client_id, account_id, scopes)); |
| 819 return iter == pending_fetchers_.end() ? | 824 return iter == pending_fetchers_.end() ? |
| 820 0 : iter->second->GetWaitingRequestCount(); | 825 0 : iter->second->GetWaitingRequestCount(); |
| 821 } | 826 } |
| OLD | NEW |