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/ui/toolbar/toolbar_actions_model_factory.h"
7 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/toolbar/toolbar_actions_model.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"
16 ToolbarActionsModel
* ToolbarActionsModelFactory::GetForProfile(
18 return static_cast<ToolbarActionsModel
*>(
19 GetInstance()->GetServiceForBrowserContext(profile
, true));
23 ToolbarActionsModelFactory
* ToolbarActionsModelFactory::GetInstance() {
24 return Singleton
<ToolbarActionsModelFactory
>::get();
27 ToolbarActionsModelFactory::ToolbarActionsModelFactory()
28 : BrowserContextKeyedServiceFactory(
29 "ToolbarActionsModel",
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
32 DependsOn(extensions::ExtensionActionAPI::GetFactoryInstance());
35 ToolbarActionsModelFactory::~ToolbarActionsModelFactory() {}
37 KeyedService
* ToolbarActionsModelFactory::BuildServiceInstanceFor(
38 content::BrowserContext
* context
) const {
39 return new ToolbarActionsModel(
40 Profile::FromBrowserContext(context
),
41 extensions::ExtensionPrefsFactory::GetForBrowserContext(context
));
44 content::BrowserContext
* ToolbarActionsModelFactory::GetBrowserContextToUse(
45 content::BrowserContext
* context
) const {
49 bool ToolbarActionsModelFactory::ServiceIsCreatedWithBrowserContext() const {
53 bool ToolbarActionsModelFactory::ServiceIsNULLWhileTesting() const {