OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/profiles/profile.h" |
| 6 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" |
| 7 |
| 8 // static |
| 9 BrowserContextKeyedService* FakeProfileOAuth2TokenServiceWrapper::Build( |
| 10 content::BrowserContext* context) { |
| 11 Profile* profile = static_cast<Profile*>(context); |
| 12 return new FakeProfileOAuth2TokenServiceWrapper(profile, false); |
| 13 } |
| 14 |
| 15 // static |
| 16 BrowserContextKeyedService* |
| 17 FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService( |
| 18 content::BrowserContext* context) { |
| 19 Profile* profile = static_cast<Profile*>(context); |
| 20 return new FakeProfileOAuth2TokenServiceWrapper(profile, true); |
| 21 } |
| 22 |
| 23 FakeProfileOAuth2TokenServiceWrapper::FakeProfileOAuth2TokenServiceWrapper( |
| 24 Profile* profile, |
| 25 bool auto_issue_tokens) { |
| 26 if (auto_issue_tokens) |
| 27 service_.set_auto_post_fetch_response_on_message_loop(true); |
| 28 service_.Initialize(reinterpret_cast<Profile*>(profile)); |
| 29 } |
| 30 |
| 31 FakeProfileOAuth2TokenServiceWrapper::~FakeProfileOAuth2TokenServiceWrapper() { |
| 32 service_.Shutdown(); |
| 33 } |
| 34 |
| 35 ProfileOAuth2TokenService* |
| 36 FakeProfileOAuth2TokenServiceWrapper::GetProfileOAuth2TokenService() { |
| 37 return &service_; |
| 38 } |
OLD | NEW |