1 // Copyright (c) 2013 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/extensions/install_limiter_factory.h"
6 
7 #include "chrome/browser/chromeos/extensions/install_limiter.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extension_system_provider.h"
11 #include "extensions/browser/extensions_browser_client.h"
12 
13 namespace extensions {
14 
15 // static
GetForProfile(Profile * profile)16 InstallLimiter* InstallLimiterFactory::GetForProfile(Profile* profile) {
17   return static_cast<InstallLimiter*>(
18       GetInstance()->GetServiceForBrowserContext(profile, true));
19 }
20 
21 // static
GetInstance()22 InstallLimiterFactory* InstallLimiterFactory::GetInstance() {
23   return base::Singleton<InstallLimiterFactory>::get();
24 }
25 
InstallLimiterFactory()26 InstallLimiterFactory::InstallLimiterFactory()
27     : BrowserContextKeyedServiceFactory(
28         "InstallLimiter",
29         BrowserContextDependencyManager::GetInstance()) {
30   DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
31 }
32 
~InstallLimiterFactory()33 InstallLimiterFactory::~InstallLimiterFactory() {
34 }
35 
BuildServiceInstanceFor(content::BrowserContext * profile) const36 KeyedService* InstallLimiterFactory::BuildServiceInstanceFor(
37     content::BrowserContext* profile) const {
38   return new InstallLimiter();
39 }
40 
41 }  // namespace extensions
42