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/chrome_to_mobile_service_factory.h"
7 #include "chrome/browser/chrome_to_mobile_service.h"
8 #include "chrome/browser/profiles/profile_dependency_manager.h"
9 #include "chrome/browser/signin/token_service_factory.h"
10 #include "chrome/browser/sync/profile_sync_service_factory.h"
13 ChromeToMobileServiceFactory
* ChromeToMobileServiceFactory::GetInstance() {
14 return Singleton
<ChromeToMobileServiceFactory
>::get();
18 ChromeToMobileService
* ChromeToMobileServiceFactory::GetForProfile(
20 return static_cast<ChromeToMobileService
*>(
21 GetInstance()->GetServiceForProfile(profile
, true));
24 ProfileKeyedService
* ChromeToMobileServiceFactory::BuildServiceInstanceFor(
25 Profile
* profile
) const {
26 // Ensure that the service is not instantiated or used if it is disabled.
27 if (!ChromeToMobileService::IsChromeToMobileEnabled())
30 return new ChromeToMobileService(profile
);
33 ChromeToMobileServiceFactory::ChromeToMobileServiceFactory()
34 : ProfileKeyedServiceFactory("ChromeToMobileService",
35 ProfileDependencyManager::GetInstance()) {
36 DependsOn(ProfileSyncServiceFactory::GetInstance());
37 DependsOn(TokenServiceFactory::GetInstance());
38 // TODO(msw): Uncomment this once it exists.
39 // DependsOn(PrefServiceFactory::GetInstance());
42 ChromeToMobileServiceFactory::~ChromeToMobileServiceFactory() {}