1 // Copyright 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.
5 #include "chrome/browser/extensions/extension_toolbar_model_factory.h"
7 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
8 #include "chrome/browser/extensions/extension_toolbar_model.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "extensions/browser/extension_prefs.h"
12 #include "extensions/browser/extension_prefs_factory.h"
13 #include "extensions/browser/extensions_browser_client.h"
15 namespace extensions
{
18 ExtensionToolbarModel
* ExtensionToolbarModelFactory::GetForProfile(
20 return static_cast<ExtensionToolbarModel
*>(
21 GetInstance()->GetServiceForBrowserContext(profile
, true));
25 ExtensionToolbarModelFactory
* ExtensionToolbarModelFactory::GetInstance() {
26 return Singleton
<ExtensionToolbarModelFactory
>::get();
29 ExtensionToolbarModelFactory::ExtensionToolbarModelFactory()
30 : BrowserContextKeyedServiceFactory(
31 "ExtensionToolbarModel",
32 BrowserContextDependencyManager::GetInstance()) {
33 DependsOn(ExtensionPrefsFactory::GetInstance());
34 DependsOn(ExtensionActionAPI::GetFactoryInstance());
37 ExtensionToolbarModelFactory::~ExtensionToolbarModelFactory() {}
39 KeyedService
* ExtensionToolbarModelFactory::BuildServiceInstanceFor(
40 content::BrowserContext
* context
) const {
41 return new ExtensionToolbarModel(
42 Profile::FromBrowserContext(context
),
43 ExtensionPrefsFactory::GetForBrowserContext(context
));
46 content::BrowserContext
* ExtensionToolbarModelFactory::GetBrowserContextToUse(
47 content::BrowserContext
* context
) const {
51 bool ExtensionToolbarModelFactory::ServiceIsCreatedWithBrowserContext() const {
55 bool ExtensionToolbarModelFactory::ServiceIsNULLWhileTesting() const {
59 } // namespace extensions