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
{
17 MenuManager
* MenuManagerFactory::GetForProfile(
19 return static_cast<MenuManager
*>(
20 GetInstance()->GetServiceForBrowserContext(profile
, true));
24 MenuManagerFactory
* MenuManagerFactory::GetInstance() {
25 return Singleton
<MenuManagerFactory
>::get();
28 MenuManagerFactory::MenuManagerFactory()
29 : BrowserContextKeyedServiceFactory(
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(
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 {
55 bool MenuManagerFactory::ServiceIsNULLWhileTesting() const {
59 } // namespace extensions