1 // Copyright 2014 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/apps/per_app_settings_service_factory.h"
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/apps/per_app_settings_service.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extensions_browser_client.h"
13 PerAppSettingsServiceFactory
* PerAppSettingsServiceFactory::GetInstance() {
14 return Singleton
<PerAppSettingsServiceFactory
>::get();
18 PerAppSettingsService
* PerAppSettingsServiceFactory::GetForBrowserContext(
19 content::BrowserContext
* browser_context
) {
20 return static_cast<PerAppSettingsService
*>(
21 GetInstance()->GetServiceForBrowserContext(
22 browser_context
, true /* create */));
25 PerAppSettingsServiceFactory::PerAppSettingsServiceFactory()
26 : BrowserContextKeyedServiceFactory(
27 "PerAppSettingsServiceFactory",
28 BrowserContextDependencyManager::GetInstance()) {
31 PerAppSettingsServiceFactory::~PerAppSettingsServiceFactory() {}
33 KeyedService
* PerAppSettingsServiceFactory::BuildServiceInstanceFor(
34 content::BrowserContext
* context
) const {
35 return new PerAppSettingsService
;
38 bool PerAppSettingsServiceFactory::ServiceIsCreatedWithBrowserContext() const {
42 content::BrowserContext
* PerAppSettingsServiceFactory::GetBrowserContextToUse(
43 content::BrowserContext
* context
) const {
44 return extensions::ExtensionsBrowserClient::Get()->
45 GetOriginalContext(context
);