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