OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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/tether/tether_service_factory.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/memory/singleton.h" |
| 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" |
| 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/pref_names.h" |
| 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 14 #include "components/pref_registry/pref_registry_syncable.h" |
| 15 |
| 16 // static |
| 17 TetherServiceFactory* TetherServiceFactory::GetInstance() { |
| 18 return base::Singleton<TetherServiceFactory>::get(); |
| 19 } |
| 20 |
| 21 // static |
| 22 TetherService* TetherServiceFactory::GetForBrowserContext( |
| 23 content::BrowserContext* browser_context) { |
| 24 return static_cast<TetherService*>( |
| 25 TetherServiceFactory::GetInstance()->GetServiceForBrowserContext( |
| 26 browser_context, true)); |
| 27 } |
| 28 |
| 29 TetherServiceFactory::TetherServiceFactory() |
| 30 : BrowserContextKeyedServiceFactory( |
| 31 "TetherService", |
| 32 BrowserContextDependencyManager::GetInstance()) { |
| 33 DependsOn(ChromeCryptAuthServiceFactory::GetInstance()); |
| 34 } |
| 35 |
| 36 TetherServiceFactory::~TetherServiceFactory() {} |
| 37 |
| 38 KeyedService* TetherServiceFactory::BuildServiceInstanceFor( |
| 39 content::BrowserContext* context) const { |
| 40 return new TetherService(Profile::FromBrowserContext(context)); |
| 41 } |
| 42 |
| 43 void TetherServiceFactory::RegisterProfilePrefs( |
| 44 user_prefs::PrefRegistrySyncable* registry) { |
| 45 TetherService::RegisterProfilePrefs(registry); |
| 46 } |
OLD | NEW |