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

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: Created 8 years 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/browser_action_handler.h "
16 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h" 17 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h"
17 #include "chrome/common/extensions/extension.h" 18 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/feature_switch.h" 19 #include "chrome/common/extensions/feature_switch.h"
19 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
21 22
22 namespace extensions { 23 namespace extensions {
23 24
24 namespace { 25 namespace {
25 26
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // need to convert page actions into browser actions. 124 // need to convert page actions into browser actions.
124 if (FeatureSwitch::script_badges()->IsEnabled()) 125 if (FeatureSwitch::script_badges()->IsEnabled())
125 return NULL; 126 return NULL;
126 return GetOrCreateOrNull(&page_actions_, extension.id(), 127 return GetOrCreateOrNull(&page_actions_, extension.id(),
127 ActionInfo::TYPE_PAGE, 128 ActionInfo::TYPE_PAGE,
128 extension.page_action_info()); 129 extension.page_action_info());
129 } 130 }
130 131
131 ExtensionAction* ExtensionActionManager::GetBrowserAction( 132 ExtensionAction* ExtensionActionManager::GetBrowserAction(
132 const extensions::Extension& extension) const { 133 const extensions::Extension& extension) const {
133 const ActionInfo* action_info = extension.browser_action_info(); 134 const ActionInfo* action_info =
135 BrowserActionInfo::GetBrowserAction(&extension);
134 ActionInfo::Type action_type = ActionInfo::TYPE_BROWSER; 136 ActionInfo::Type action_type = ActionInfo::TYPE_BROWSER;
135 if (FeatureSwitch::script_badges()->IsEnabled() && 137 if (FeatureSwitch::script_badges()->IsEnabled() &&
136 extension.page_action_info()) { 138 extension.page_action_info()) {
137 // The action box changes the meaning of the page action area, so we 139 // The action box changes the meaning of the page action area, so we
138 // need to convert page actions into browser actions. 140 // need to convert page actions into browser actions.
139 action_info = extension.page_action_info(); 141 action_info = extension.page_action_info();
140 action_type = ActionInfo::TYPE_PAGE; 142 action_type = ActionInfo::TYPE_PAGE;
141 } 143 }
142 return GetOrCreateOrNull(&browser_actions_, extension.id(), 144 return GetOrCreateOrNull(&browser_actions_, extension.id(),
143 action_type, action_info); 145 action_type, action_info);
(...skipping 14 matching lines...) Expand all
158 } 160 }
159 161
160 ExtensionAction* ExtensionActionManager::GetScriptBadge( 162 ExtensionAction* ExtensionActionManager::GetScriptBadge(
161 const extensions::Extension& extension) const { 163 const extensions::Extension& extension) const {
162 return GetOrCreateOrNull(&script_badges_, extension.id(), 164 return GetOrCreateOrNull(&script_badges_, extension.id(),
163 ActionInfo::TYPE_SCRIPT_BADGE, 165 ActionInfo::TYPE_SCRIPT_BADGE,
164 ScriptBadgeInfo::GetScriptBadge(&extension)); 166 ScriptBadgeInfo::GetScriptBadge(&extension));
165 } 167 }
166 168
167 } // namespace extensions 169 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698