ExtensionSyncService: listen for relevant changes instead of being explicitly called...
[chromium-blink-merge.git] / chrome / browser / ui / toolbar / toolbar_actions_model_factory.cc
blobb6e80eeea066d71015d5d8b16a81c9e489a26582
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"
15 // static
16 ToolbarActionsModel* ToolbarActionsModelFactory::GetForProfile(
17 Profile* profile) {
18 return static_cast<ToolbarActionsModel*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true));
22 // static
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 {
46 return context;
49 bool ToolbarActionsModelFactory::ServiceIsCreatedWithBrowserContext() const {
50 return true;
53 bool ToolbarActionsModelFactory::ServiceIsNULLWhileTesting() const {
54 return true;