1 // Copyright 2019 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/child_accounts/child_user_service_factory.h"
6 
7 #include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
8 #include "chrome/browser/chromeos/child_accounts/child_user_service.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 
11 namespace chromeos {
12 
13 // static
GetForBrowserContext(content::BrowserContext * context)14 ChildUserService* ChildUserServiceFactory::GetForBrowserContext(
15     content::BrowserContext* context) {
16   return static_cast<ChildUserService*>(
17       GetInstance()->GetServiceForBrowserContext(context, true));
18 }
19 
20 // static
GetInstance()21 ChildUserServiceFactory* ChildUserServiceFactory::GetInstance() {
22   static base::NoDestructor<ChildUserServiceFactory> factory;
23   return factory.get();
24 }
25 
ChildUserServiceFactory()26 ChildUserServiceFactory::ChildUserServiceFactory()
27     : BrowserContextKeyedServiceFactory(
28           "ChildUserServiceFactory",
29           BrowserContextDependencyManager::GetInstance()) {
30   DependsOn(apps::AppServiceProxyFactory::GetInstance());
31 }
32 
33 ChildUserServiceFactory::~ChildUserServiceFactory() = default;
34 
BuildServiceInstanceFor(content::BrowserContext * context) const35 KeyedService* ChildUserServiceFactory::BuildServiceInstanceFor(
36     content::BrowserContext* context) const {
37   return new ChildUserService(context);
38 }
39 
40 }  // namespace chromeos
41