Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / settings_private / settings_private_delegate_factory.cc
blobfc56bc34f9f7ffda62157d955303fba4a289bcf4
1 // Copyright 2015 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/extensions/api/settings_private/settings_private_delegate_factory.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/extensions/api/settings_private/settings_private_delegate.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "extensions/browser/extension_system_provider.h"
13 namespace extensions {
15 using content::BrowserContext;
17 // static
18 SettingsPrivateDelegate* SettingsPrivateDelegateFactory::GetForBrowserContext(
19 BrowserContext* browser_context) {
20 return static_cast<SettingsPrivateDelegate*>(
21 GetInstance()->GetServiceForBrowserContext(browser_context, true));
24 // static
25 SettingsPrivateDelegateFactory* SettingsPrivateDelegateFactory::GetInstance() {
26 return base::Singleton<SettingsPrivateDelegateFactory>::get();
29 SettingsPrivateDelegateFactory::SettingsPrivateDelegateFactory()
30 : BrowserContextKeyedServiceFactory(
31 "SettingsPrivateDelegate",
32 BrowserContextDependencyManager::GetInstance()) {
35 SettingsPrivateDelegateFactory::~SettingsPrivateDelegateFactory() {
38 KeyedService* SettingsPrivateDelegateFactory::BuildServiceInstanceFor(
39 content::BrowserContext* profile) const {
40 return new SettingsPrivateDelegate(static_cast<Profile*>(profile));
43 } // namespace extensions