| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/chrome_to_mobile_service_factory.h" | 5 #include "chrome/browser/chrome_to_mobile_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_to_mobile_service.h" | 7 #include "chrome/browser/chrome_to_mobile_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/profiles/profile_dependency_manager.h" | 9 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 9 #include "chrome/browser/signin/token_service_factory.h" | 10 #include "chrome/browser/signin/token_service_factory.h" |
| 10 #include "chrome/browser/sync/profile_sync_service_factory.h" | 11 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 11 | 12 |
| 12 // static | 13 // static |
| 13 ChromeToMobileServiceFactory* ChromeToMobileServiceFactory::GetInstance() { | 14 ChromeToMobileServiceFactory* ChromeToMobileServiceFactory::GetInstance() { |
| 14 return Singleton<ChromeToMobileServiceFactory>::get(); | 15 return Singleton<ChromeToMobileServiceFactory>::get(); |
| 15 } | 16 } |
| 16 | 17 |
| 17 // static | 18 // static |
| 18 ChromeToMobileService* ChromeToMobileServiceFactory::GetForProfile( | 19 ChromeToMobileService* ChromeToMobileServiceFactory::GetForProfile( |
| 19 Profile* profile) { | 20 Profile* profile) { |
| 20 return static_cast<ChromeToMobileService*>( | 21 return static_cast<ChromeToMobileService*>( |
| 21 GetInstance()->GetServiceForProfile(profile, true)); | 22 GetInstance()->GetServiceForProfile(profile, true)); |
| 22 } | 23 } |
| 23 | 24 |
| 24 ProfileKeyedService* ChromeToMobileServiceFactory::BuildServiceInstanceFor( | 25 ProfileKeyedService* ChromeToMobileServiceFactory::BuildServiceInstanceFor( |
| 25 Profile* profile) const { | 26 content::BrowserContext* profile) const { |
| 26 // Ensure that the service is not instantiated or used if it is disabled. | 27 // Ensure that the service is not instantiated or used if it is disabled. |
| 27 if (!ChromeToMobileService::IsChromeToMobileEnabled()) | 28 if (!ChromeToMobileService::IsChromeToMobileEnabled()) |
| 28 return NULL; | 29 return NULL; |
| 29 | 30 |
| 30 return new ChromeToMobileService(profile); | 31 return new ChromeToMobileService(static_cast<Profile*>(profile)); |
| 31 } | 32 } |
| 32 | 33 |
| 33 ChromeToMobileServiceFactory::ChromeToMobileServiceFactory() | 34 ChromeToMobileServiceFactory::ChromeToMobileServiceFactory() |
| 34 : ProfileKeyedServiceFactory("ChromeToMobileService", | 35 : ProfileKeyedServiceFactory("ChromeToMobileService", |
| 35 ProfileDependencyManager::GetInstance()) { | 36 ProfileDependencyManager::GetInstance()) { |
| 36 DependsOn(ProfileSyncServiceFactory::GetInstance()); | 37 DependsOn(ProfileSyncServiceFactory::GetInstance()); |
| 37 DependsOn(TokenServiceFactory::GetInstance()); | 38 DependsOn(TokenServiceFactory::GetInstance()); |
| 38 // TODO(msw): Uncomment this once it exists. | 39 // TODO(msw): Uncomment this once it exists. |
| 39 // DependsOn(PrefServiceFactory::GetInstance()); | 40 // DependsOn(PrefServiceFactory::GetInstance()); |
| 40 } | 41 } |
| 41 | 42 |
| 42 ChromeToMobileServiceFactory::~ChromeToMobileServiceFactory() {} | 43 ChromeToMobileServiceFactory::~ChromeToMobileServiceFactory() {} |
| OLD | NEW |