| 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 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 9 | 11 |
| 10 FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() { | 12 FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() { |
| 11 } | 13 } |
| 12 | 14 |
| 13 FakeProfileOAuth2TokenService::PendingRequest::~PendingRequest() { | 15 FakeProfileOAuth2TokenService::PendingRequest::~PendingRequest() { |
| 14 } | 16 } |
| 15 | 17 |
| 16 FakeProfileOAuth2TokenService::FakeProfileOAuth2TokenService() | 18 FakeProfileOAuth2TokenService::FakeProfileOAuth2TokenService() |
| 17 : auto_post_fetch_response_on_message_loop_(false), | 19 : auto_post_fetch_response_on_message_loop_(false), |
| 18 weak_ptr_factory_(this) { | 20 weak_ptr_factory_(this) { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 const ScopeSet& scopes) { | 185 const ScopeSet& scopes) { |
| 184 PendingRequest pending_request; | 186 PendingRequest pending_request; |
| 185 pending_request.account_id = account_id; | 187 pending_request.account_id = account_id; |
| 186 pending_request.client_id = client_id; | 188 pending_request.client_id = client_id; |
| 187 pending_request.client_secret = client_secret; | 189 pending_request.client_secret = client_secret; |
| 188 pending_request.scopes = scopes; | 190 pending_request.scopes = scopes; |
| 189 pending_request.request = request->AsWeakPtr(); | 191 pending_request.request = request->AsWeakPtr(); |
| 190 pending_requests_.push_back(pending_request); | 192 pending_requests_.push_back(pending_request); |
| 191 | 193 |
| 192 if (auto_post_fetch_response_on_message_loop_) { | 194 if (auto_post_fetch_response_on_message_loop_) { |
| 193 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 195 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 194 &FakeProfileOAuth2TokenService::IssueAllTokensForAccount, | 196 FROM_HERE, |
| 195 weak_ptr_factory_.GetWeakPtr(), | 197 base::Bind(&FakeProfileOAuth2TokenService::IssueAllTokensForAccount, |
| 196 account_id, | 198 weak_ptr_factory_.GetWeakPtr(), account_id, "access_token", |
| 197 "access_token", | 199 base::Time::Max())); |
| 198 base::Time::Max())); | |
| 199 } | 200 } |
| 200 } | 201 } |
| 201 | 202 |
| 202 OAuth2AccessTokenFetcher* | 203 OAuth2AccessTokenFetcher* |
| 203 FakeProfileOAuth2TokenService::CreateAccessTokenFetcher( | 204 FakeProfileOAuth2TokenService::CreateAccessTokenFetcher( |
| 204 const std::string& account_id, | 205 const std::string& account_id, |
| 205 net::URLRequestContextGetter* getter, | 206 net::URLRequestContextGetter* getter, |
| 206 OAuth2AccessTokenConsumer* consumer) { | 207 OAuth2AccessTokenConsumer* consumer) { |
| 207 NOTREACHED(); | 208 NOTREACHED(); |
| 208 return NULL; | 209 return NULL; |
| 209 } | 210 } |
| 210 | 211 |
| 211 void FakeProfileOAuth2TokenService::InvalidateOAuth2Token( | 212 void FakeProfileOAuth2TokenService::InvalidateOAuth2Token( |
| 212 const std::string& account_id, | 213 const std::string& account_id, |
| 213 const std::string& client_id, | 214 const std::string& client_id, |
| 214 const ScopeSet& scopes, | 215 const ScopeSet& scopes, |
| 215 const std::string& access_token) { | 216 const std::string& access_token) { |
| 216 // Do nothing, as we don't have a cache from which to remove the token. | 217 // Do nothing, as we don't have a cache from which to remove the token. |
| 217 } | 218 } |
| OLD | NEW |