Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / extension_toolbar_model_factory.cc
bloba51904c8686492bcca781c1cda92c1548f78fef4
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 {
17 // static
18 ExtensionToolbarModel* ExtensionToolbarModelFactory::GetForProfile(
19 Profile* profile) {
20 return static_cast<ExtensionToolbarModel*>(
21 GetInstance()->GetServiceForBrowserContext(profile, true));
24 // static
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 {
48 return context;
51 bool ExtensionToolbarModelFactory::ServiceIsCreatedWithBrowserContext() const {
52 return true;
55 bool ExtensionToolbarModelFactory::ServiceIsNULLWhileTesting() const {
56 return true;
59 } // namespace extensions