Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / menu_manager_factory.cc
blob39e013bf9aef932b3b464c6720df52bf6004178a
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/menu_manager_factory.h"
7 #include "chrome/browser/extensions/extension_system.h"
8 #include "chrome/browser/extensions/extension_system_factory.h"
9 #include "chrome/browser/extensions/menu_manager.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 namespace extensions {
16 // static
17 MenuManager* MenuManagerFactory::GetForProfile(
18 Profile* profile) {
19 return static_cast<MenuManager*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true));
23 // static
24 MenuManagerFactory* MenuManagerFactory::GetInstance() {
25 return Singleton<MenuManagerFactory>::get();
28 MenuManagerFactory::MenuManagerFactory()
29 : BrowserContextKeyedServiceFactory(
30 "MenuManager",
31 BrowserContextDependencyManager::GetInstance()) {
32 DependsOn(ExtensionSystemFactory::GetInstance());
35 MenuManagerFactory::~MenuManagerFactory() {}
37 BrowserContextKeyedService*
38 MenuManagerFactory::BuildServiceInstanceFor(
39 content::BrowserContext* context) const {
40 Profile* profile = Profile::FromBrowserContext(context);
41 return new MenuManager(
42 profile,
43 ExtensionSystem::Get(profile)->state_store());
46 content::BrowserContext* MenuManagerFactory::GetBrowserContextToUse(
47 content::BrowserContext* context) const {
48 return chrome::GetBrowserContextRedirectedInIncognito(context);
51 bool MenuManagerFactory::ServiceIsCreatedWithBrowserContext() const {
52 return true;
55 bool MenuManagerFactory::ServiceIsNULLWhileTesting() const {
56 return true;
59 } // namespace extensions