Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / signin / profile_oauth2_token_service_factory.cc
blobc8baf9eb598cf63fa61020bf92d29f7b3c5fd866
1 // Copyright (c) 2012 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.
5 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/signin/profile_oauth2_token_service.h"
9 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
10 #include "chrome/browser/webdata/web_data_service_factory.h"
11 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
13 #if defined(OS_ANDROID)
14 #include "chrome/browser/signin/android_profile_oauth2_token_service.h"
15 #else
16 #include "chrome/browser/signin/mutable_profile_oauth2_token_service.h"
17 #endif
19 ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory()
20 : BrowserContextKeyedServiceFactory(
21 "ProfileOAuth2TokenService",
22 BrowserContextDependencyManager::GetInstance()) {
23 DependsOn(GlobalErrorServiceFactory::GetInstance());
24 DependsOn(WebDataServiceFactory::GetInstance());
27 ProfileOAuth2TokenServiceFactory::~ProfileOAuth2TokenServiceFactory() {
30 ProfileOAuth2TokenService*
31 ProfileOAuth2TokenServiceFactory::GetForProfile(Profile* profile) {
32 return static_cast<ProfileOAuth2TokenService*>(
33 GetInstance()->GetServiceForBrowserContext(profile, true));
36 // static
37 ProfileOAuth2TokenServiceFactory::PlatformSpecificOAuth2TokenService*
38 ProfileOAuth2TokenServiceFactory::GetPlatformSpecificForProfile(
39 Profile* profile) {
40 return static_cast<PlatformSpecificOAuth2TokenService*>(
41 GetForProfile(profile));
44 // static
45 ProfileOAuth2TokenServiceFactory*
46 ProfileOAuth2TokenServiceFactory::GetInstance() {
47 return Singleton<ProfileOAuth2TokenServiceFactory>::get();
50 BrowserContextKeyedService*
51 ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor(
52 content::BrowserContext* context) const {
53 Profile* profile = static_cast<Profile*>(context);
54 PlatformSpecificOAuth2TokenService* service =
55 new PlatformSpecificOAuth2TokenService();
56 service->Initialize(profile);
57 return service;