Revert 285173 "Removed InProcessBrowserTest::CleanUpOnMainThread()"
[chromium-blink-merge.git] / chrome / browser / extensions / menu_manager_factory.cc
blobc90d888a4f34656e3edfa2bd30569ddebf5970d4
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::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(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
35 MenuManagerFactory::~MenuManagerFactory() {}
37 KeyedService* MenuManagerFactory::BuildServiceInstanceFor(
38 content::BrowserContext* context) const {
39 Profile* profile = Profile::FromBrowserContext(context);
40 return new MenuManager(
41 profile,
42 ExtensionSystem::Get(profile)->state_store());
45 content::BrowserContext* MenuManagerFactory::GetBrowserContextToUse(
46 content::BrowserContext* context) const {
47 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
50 bool MenuManagerFactory::ServiceIsCreatedWithBrowserContext() const {
51 return true;
54 bool MenuManagerFactory::ServiceIsNULLWhileTesting() const {
55 return true;
58 } // namespace extensions