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

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

Issue 11644057: Move BrowserAction out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_ungoop_extension_action
Patch Set: Combined ActionInfo wrappers Created 7 years, 12 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
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/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_dependency_manager.h" 12 #include "chrome/browser/profiles/profile_dependency_manager.h"
13 #include "chrome/browser/profiles/profile_keyed_service_factory.h" 13 #include "chrome/browser/profiles/profile_keyed_service_factory.h"
14 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/extensions/api/extension_action/action_info.h" 15 #include "chrome/common/extensions/api/extension_action/action_info.h"
16 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h"
17 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/feature_switch.h" 17 #include "chrome/common/extensions/feature_switch.h"
19 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
21 20
22 namespace extensions { 21 namespace extensions {
23 22
24 namespace { 23 namespace {
25 24
26 // ProfileKeyedServiceFactory for ExtensionActionManager. 25 // ProfileKeyedServiceFactory for ExtensionActionManager.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // need to convert page actions into browser actions. 122 // need to convert page actions into browser actions.
124 if (FeatureSwitch::script_badges()->IsEnabled()) 123 if (FeatureSwitch::script_badges()->IsEnabled())
125 return NULL; 124 return NULL;
126 return GetOrCreateOrNull(&page_actions_, extension.id(), 125 return GetOrCreateOrNull(&page_actions_, extension.id(),
127 ActionInfo::TYPE_PAGE, 126 ActionInfo::TYPE_PAGE,
128 extension.page_action_info()); 127 extension.page_action_info());
129 } 128 }
130 129
131 ExtensionAction* ExtensionActionManager::GetBrowserAction( 130 ExtensionAction* ExtensionActionManager::GetBrowserAction(
132 const extensions::Extension& extension) const { 131 const extensions::Extension& extension) const {
133 const ActionInfo* action_info = extension.browser_action_info(); 132 const ActionInfo* action_info =
133 ActionInfoData::GetBrowserActionInfo(&extension);
134 ActionInfo::Type action_type = ActionInfo::TYPE_BROWSER; 134 ActionInfo::Type action_type = ActionInfo::TYPE_BROWSER;
135 if (FeatureSwitch::script_badges()->IsEnabled() && 135 if (FeatureSwitch::script_badges()->IsEnabled() &&
136 extension.page_action_info()) { 136 extension.page_action_info()) {
137 // The action box changes the meaning of the page action area, so we 137 // The action box changes the meaning of the page action area, so we
138 // need to convert page actions into browser actions. 138 // need to convert page actions into browser actions.
139 action_info = extension.page_action_info(); 139 action_info = extension.page_action_info();
140 action_type = ActionInfo::TYPE_PAGE; 140 action_type = ActionInfo::TYPE_PAGE;
141 } 141 }
142 return GetOrCreateOrNull(&browser_actions_, extension.id(), 142 return GetOrCreateOrNull(&browser_actions_, extension.id(),
143 action_type, action_info); 143 action_type, action_info);
(...skipping 10 matching lines...) Expand all
154 154
155 return GetOrCreateOrNull(&system_indicators_, extension.id(), 155 return GetOrCreateOrNull(&system_indicators_, extension.id(),
156 ActionInfo::TYPE_SYSTEM_INDICATOR, 156 ActionInfo::TYPE_SYSTEM_INDICATOR,
157 extension.system_indicator_info()); 157 extension.system_indicator_info());
158 } 158 }
159 159
160 ExtensionAction* ExtensionActionManager::GetScriptBadge( 160 ExtensionAction* ExtensionActionManager::GetScriptBadge(
161 const extensions::Extension& extension) const { 161 const extensions::Extension& extension) const {
162 return GetOrCreateOrNull(&script_badges_, extension.id(), 162 return GetOrCreateOrNull(&script_badges_, extension.id(),
163 ActionInfo::TYPE_SCRIPT_BADGE, 163 ActionInfo::TYPE_SCRIPT_BADGE,
164 ScriptBadgeInfo::GetScriptBadge(&extension)); 164 ActionInfoData::GetScriptBadgeInfo(&extension));
165 } 165 }
166 166
167 } // namespace extensions 167 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698