| 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 "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 5 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 6 | 6 |
| 7 FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() { | 7 FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() { |
| 8 } | 8 } |
| 9 | 9 |
| 10 FakeProfileOAuth2TokenService::PendingRequest::~PendingRequest() { | 10 FakeProfileOAuth2TokenService::PendingRequest::~PendingRequest() { |
| 11 } | 11 } |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 BrowserContextKeyedService* FakeProfileOAuth2TokenService::Build( | 14 BrowserContextKeyedService* FakeProfileOAuth2TokenService::Build( |
| 15 content::BrowserContext* profile) { | 15 content::BrowserContext* profile) { |
| 16 return new FakeProfileOAuth2TokenService(); | 16 FakeProfileOAuth2TokenService* service = new FakeProfileOAuth2TokenService(); |
| 17 service->Initialize(reinterpret_cast<Profile*>(profile)); |
| 18 return service; |
| 17 } | 19 } |
| 18 | 20 |
| 19 FakeProfileOAuth2TokenService::FakeProfileOAuth2TokenService() { | 21 FakeProfileOAuth2TokenService::FakeProfileOAuth2TokenService() { |
| 20 } | 22 } |
| 21 | 23 |
| 22 FakeProfileOAuth2TokenService::~FakeProfileOAuth2TokenService() { | 24 FakeProfileOAuth2TokenService::~FakeProfileOAuth2TokenService() { |
| 23 } | 25 } |
| 24 | 26 |
| 25 void FakeProfileOAuth2TokenService::Shutdown() { | |
| 26 // Do not call the base class handler because it assumes that Initialize() | |
| 27 // is always called before Shutdown() and that's not the case for this mock. | |
| 28 } | |
| 29 | |
| 30 void FakeProfileOAuth2TokenService::IssueRefreshToken( | 27 void FakeProfileOAuth2TokenService::IssueRefreshToken( |
| 31 const std::string& token) { | 28 const std::string& token) { |
| 32 refresh_token_ = token; | 29 refresh_token_ = token; |
| 33 if (refresh_token_.empty()) | 30 if (refresh_token_.empty()) |
| 34 FireRefreshTokenRevoked("account_id"); | 31 FireRefreshTokenRevoked("account_id"); |
| 35 else | 32 else |
| 36 FireRefreshTokenAvailable("account_id"); | 33 FireRefreshTokenAvailable("account_id"); |
| 37 // TODO(atwilson): Maybe we should also call FireRefreshTokensLoaded() here? | 34 // TODO(atwilson): Maybe we should also call FireRefreshTokensLoaded() here? |
| 38 } | 35 } |
| 39 | 36 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 const std::string& client_id, | 108 const std::string& client_id, |
| 112 const std::string& client_secret, | 109 const std::string& client_secret, |
| 113 const ScopeSet& scopes) { | 110 const ScopeSet& scopes) { |
| 114 PendingRequest pending_request; | 111 PendingRequest pending_request; |
| 115 pending_request.client_id = client_id; | 112 pending_request.client_id = client_id; |
| 116 pending_request.client_secret = client_secret; | 113 pending_request.client_secret = client_secret; |
| 117 pending_request.scopes = scopes; | 114 pending_request.scopes = scopes; |
| 118 pending_request.request = request->AsWeakPtr(); | 115 pending_request.request = request->AsWeakPtr(); |
| 119 pending_requests_.push_back(pending_request); | 116 pending_requests_.push_back(pending_request); |
| 120 } | 117 } |
| OLD | NEW |