Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1194)

Side by Side Diff: chrome/browser/extensions/extension_action_manager.cc

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_action_manager.h" 5 #include "chrome/browser/extensions/extension_action_manager.h"
6 6
7 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage r.h" 7 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage r.h"
8 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage r_factory.h" 8 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage r_factory.h"
9 #include "chrome/browser/extensions/extension_action.h" 9 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
11 #include "chrome/browser/profiles/incognito_helpers.h" 11 #include "chrome/browser/profiles/incognito_helpers.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/common/extensions/api/extension_action/action_info.h" 14 #include "chrome/common/extensions/api/extension_action/action_info.h"
15 #include "chrome/common/extensions/api/extension_action/page_action_handler.h" 15 #include "chrome/common/extensions/api/extension_action/page_action_handler.h"
16 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h" 16 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h"
17 #include "chrome/common/extensions/extension.h" 17 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/feature_switch.h" 18 #include "chrome/common/extensions/feature_switch.h"
19 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 19 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
20 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h" 20 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_source.h" 22 #include "content/public/browser/notification_source.h"
23 23
24 namespace extensions { 24 namespace extensions {
25 25
26 namespace { 26 namespace {
27 27
28 // ProfileKeyedServiceFactory for ExtensionActionManager. 28 // BrowserContextKeyedServiceFactory for ExtensionActionManager.
29 class ExtensionActionManagerFactory : public ProfileKeyedServiceFactory { 29 class ExtensionActionManagerFactory : public BrowserContextKeyedServiceFactory {
30 public: 30 public:
31 // ProfileKeyedServiceFactory implementation: 31 // BrowserContextKeyedServiceFactory implementation:
32 static ExtensionActionManager* GetForProfile(Profile* profile) { 32 static ExtensionActionManager* GetForProfile(Profile* profile) {
33 return static_cast<ExtensionActionManager*>( 33 return static_cast<ExtensionActionManager*>(
34 GetInstance()->GetServiceForProfile(profile, true)); 34 GetInstance()->GetServiceForBrowserContext(profile, true));
35 } 35 }
36 36
37 static ExtensionActionManagerFactory* GetInstance(); 37 static ExtensionActionManagerFactory* GetInstance();
38 38
39 private: 39 private:
40 friend struct DefaultSingletonTraits<ExtensionActionManagerFactory>; 40 friend struct DefaultSingletonTraits<ExtensionActionManagerFactory>;
41 41
42 ExtensionActionManagerFactory() 42 ExtensionActionManagerFactory()
43 : ProfileKeyedServiceFactory("ExtensionActionManager", 43 : BrowserContextKeyedServiceFactory(
44 ProfileDependencyManager::GetInstance()) { 44 "ExtensionActionManager",
45 BrowserContextDependencyManager::GetInstance()) {
45 } 46 }
46 47
47 virtual ProfileKeyedService* BuildServiceInstanceFor( 48 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
48 content::BrowserContext* profile) const OVERRIDE { 49 content::BrowserContext* profile) const OVERRIDE {
49 return new ExtensionActionManager(static_cast<Profile*>(profile)); 50 return new ExtensionActionManager(static_cast<Profile*>(profile));
50 } 51 }
51 52
52 virtual content::BrowserContext* GetBrowserContextToUse( 53 virtual content::BrowserContext* GetBrowserContextToUse(
53 content::BrowserContext* context) const OVERRIDE { 54 content::BrowserContext* context) const OVERRIDE {
54 return chrome::GetBrowserContextRedirectedInIncognito(context); 55 return chrome::GetBrowserContextRedirectedInIncognito(context);
55 } 56 }
56 }; 57 };
57 58
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 162 }
162 163
163 ExtensionAction* ExtensionActionManager::GetScriptBadge( 164 ExtensionAction* ExtensionActionManager::GetScriptBadge(
164 const extensions::Extension& extension) const { 165 const extensions::Extension& extension) const {
165 return GetOrCreateOrNull(&script_badges_, extension.id(), 166 return GetOrCreateOrNull(&script_badges_, extension.id(),
166 ActionInfo::TYPE_SCRIPT_BADGE, 167 ActionInfo::TYPE_SCRIPT_BADGE,
167 ActionInfo::GetScriptBadgeInfo(&extension)); 168 ActionInfo::GetScriptBadgeInfo(&extension));
168 } 169 }
169 170
170 } // namespace extensions 171 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698