Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / menu_manager_factory.cc
blob2bfd3cbb9e41dc4139c8d88373bca38125767745
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/menu_manager.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extension_system.h"
11 #include "extensions/browser/extension_system_provider.h"
12 #include "extensions/browser/extensions_browser_client.h"
14 namespace extensions {
16 // static
17 MenuManager* MenuManagerFactory::GetForBrowserContext(
18 content::BrowserContext* context) {
19 return static_cast<MenuManager*>(
20 GetInstance()->GetServiceForBrowserContext(context, true));
23 // static
24 MenuManagerFactory* MenuManagerFactory::GetInstance() {
25 return Singleton<MenuManagerFactory>::get();
28 // static
29 scoped_ptr<KeyedService> MenuManagerFactory::BuildServiceInstanceForTesting(
30 content::BrowserContext* context) {
31 return make_scoped_ptr(GetInstance()->BuildServiceInstanceFor(context));
34 MenuManagerFactory::MenuManagerFactory()
35 : BrowserContextKeyedServiceFactory(
36 "MenuManager",
37 BrowserContextDependencyManager::GetInstance()) {
38 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
41 MenuManagerFactory::~MenuManagerFactory() {}
43 KeyedService* MenuManagerFactory::BuildServiceInstanceFor(
44 content::BrowserContext* context) const {
45 Profile* profile = Profile::FromBrowserContext(context);
46 return new MenuManager(profile, ExtensionSystem::Get(profile)->state_store());
49 content::BrowserContext* MenuManagerFactory::GetBrowserContextToUse(
50 content::BrowserContext* context) const {
51 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
54 bool MenuManagerFactory::ServiceIsCreatedWithBrowserContext() const {
55 return true;
58 bool MenuManagerFactory::ServiceIsNULLWhileTesting() const {
59 return true;
62 } // namespace extensions