OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_builder.h" | 5 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | |
8 #include "chrome/browser/signin/chrome_signin_client_factory.h" | |
9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 7 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
10 #include "chrome/browser/signin/signin_error_controller_factory.h" | |
11 | 8 |
12 // TODO(blundell): Should these be namespaced? | 9 // TODO(blundell): Should these be namespaced? |
13 scoped_ptr<KeyedService> BuildFakeProfileOAuth2TokenService( | 10 scoped_ptr<KeyedService> BuildFakeProfileOAuth2TokenService( |
14 content::BrowserContext* context) { | 11 content::BrowserContext* context) { |
15 Profile* profile = Profile::FromBrowserContext(context); | |
16 scoped_ptr<FakeProfileOAuth2TokenService> service( | 12 scoped_ptr<FakeProfileOAuth2TokenService> service( |
17 new FakeProfileOAuth2TokenService()); | 13 new FakeProfileOAuth2TokenService()); |
18 service->Initialize( | |
19 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), | |
20 SigninErrorControllerFactory::GetInstance()->GetForProfile(profile)); | |
21 return service.Pass(); | 14 return service.Pass(); |
22 } | 15 } |
23 | 16 |
24 scoped_ptr<KeyedService> BuildAutoIssuingFakeProfileOAuth2TokenService( | 17 scoped_ptr<KeyedService> BuildAutoIssuingFakeProfileOAuth2TokenService( |
25 content::BrowserContext* context) { | 18 content::BrowserContext* context) { |
26 Profile* profile = Profile::FromBrowserContext(context); | |
27 scoped_ptr<FakeProfileOAuth2TokenService> service( | 19 scoped_ptr<FakeProfileOAuth2TokenService> service( |
28 new FakeProfileOAuth2TokenService()); | 20 new FakeProfileOAuth2TokenService()); |
29 service->set_auto_post_fetch_response_on_message_loop(true); | 21 service->set_auto_post_fetch_response_on_message_loop(true); |
30 service->Initialize( | |
31 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), | |
32 SigninErrorControllerFactory::GetInstance()->GetForProfile(profile)); | |
33 return service.Pass(); | 22 return service.Pass(); |
34 } | 23 } |
OLD | NEW |