Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / extension_toolbar_model_factory.cc
blob474c6a0339df4392a3941d3f0746dbfc5a67ce57
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/extension_prefs.h"
8 #include "chrome/browser/extensions/extension_prefs_factory.h"
9 #include "chrome/browser/extensions/extension_toolbar_model.h"
10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
14 // static
15 ExtensionToolbarModel* ExtensionToolbarModelFactory::GetForProfile(
16 Profile* profile) {
17 return static_cast<ExtensionToolbarModel*>(
18 GetInstance()->GetServiceForBrowserContext(profile, true));
21 // static
22 ExtensionToolbarModelFactory* ExtensionToolbarModelFactory::GetInstance() {
23 return Singleton<ExtensionToolbarModelFactory>::get();
26 ExtensionToolbarModelFactory::ExtensionToolbarModelFactory()
27 : BrowserContextKeyedServiceFactory(
28 "ExtensionToolbarModel",
29 BrowserContextDependencyManager::GetInstance()) {
30 DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
33 ExtensionToolbarModelFactory::~ExtensionToolbarModelFactory() {}
35 BrowserContextKeyedService*
36 ExtensionToolbarModelFactory::BuildServiceInstanceFor(
37 content::BrowserContext* context) const {
38 return new ExtensionToolbarModel(
39 Profile::FromBrowserContext(context),
40 extensions::ExtensionPrefsFactory::GetForBrowserContext(context));
43 content::BrowserContext* ExtensionToolbarModelFactory::GetBrowserContextToUse(
44 content::BrowserContext* context) const {
45 return chrome::GetBrowserContextRedirectedInIncognito(context);
48 bool ExtensionToolbarModelFactory::ServiceIsCreatedWithBrowserContext() const {
49 return true;
52 bool ExtensionToolbarModelFactory::ServiceIsNULLWhileTesting() const {
53 return true;