OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "chrome/browser/extensions/menu_manager_factory.h" | |
6 | |
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_ma nager.h" | |
13 | |
14 namespace extensions { | |
15 | |
16 // static | |
17 MenuManager* MenuManagerFactory::GetForProfile( | |
18 Profile* profile) { | |
19 return static_cast<MenuManager*>( | |
20 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
21 } | |
22 | |
23 // static | |
24 MenuManagerFactory* MenuManagerFactory::GetInstance() { | |
25 return Singleton<MenuManagerFactory>::get(); | |
26 } | |
27 | |
28 MenuManagerFactory::MenuManagerFactory() | |
29 : BrowserContextKeyedServiceFactory( | |
30 "MenuManager", | |
31 BrowserContextDependencyManager::GetInstance()) { | |
32 DependsOn(ExtensionSystemFactory::GetInstance()); | |
33 } | |
34 | |
35 MenuManagerFactory::~MenuManagerFactory() {} | |
36 | |
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()); | |
44 } | |
45 | |
46 content::BrowserContext* MenuManagerFactory::GetBrowserContextToUse( | |
47 content::BrowserContext* context) const { | |
48 return chrome::GetBrowserContextRedirectedInIncognito(context); | |
49 } | |
50 | |
51 bool MenuManagerFactory::ServiceIsCreatedWithBrowserContext() const { | |
52 return true; | |
53 } | |
54 | |
55 bool MenuManagerFactory::ServiceIsNULLWhileTesting() const { | |
56 return true; | |
miket_OOO
2013/11/13 16:52:18
Is this a TODO? Seems this would be false or else
benwells
2013/11/14 01:44:43
Tried to chat about this. I don't understand your
miket_OOO
2013/11/14 23:07:32
I understand now. I thought it was more of a gette
| |
57 } | |
58 | |
59 } // namespace extensions | |
OLD | NEW |