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

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

Issue 11361189: Initial skeleton for System Indicator API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Final style fixes 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/extension_action.h" 7 #include "chrome/browser/extensions/extension_action.h"
8 #include "chrome/browser/extensions/extension_system.h" 8 #include "chrome/browser/extensions/extension_system.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_dependency_manager.h" 10 #include "chrome/browser/profiles/profile_dependency_manager.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (it != map->end()) 102 if (it != map->end())
103 return it->second.get(); 103 return it->second.get();
104 if (!action_info) 104 if (!action_info)
105 return NULL; 105 return NULL;
106 linked_ptr<ExtensionAction> action(new ExtensionAction( 106 linked_ptr<ExtensionAction> action(new ExtensionAction(
107 extension_id, action_type, *action_info)); 107 extension_id, action_type, *action_info));
108 (*map)[extension_id] = action; 108 (*map)[extension_id] = action;
109 return action.get(); 109 return action.get();
110 } 110 }
111 111
112 } 112 } // namespace
113 113
114 ExtensionAction* ExtensionActionManager::GetPageAction( 114 ExtensionAction* ExtensionActionManager::GetPageAction(
115 const extensions::Extension& extension) const { 115 const extensions::Extension& extension) const {
116 // The action box changes the meaning of the page action area, so we 116 // The action box changes the meaning of the page action area, so we
117 // need to convert page actions into browser actions. 117 // need to convert page actions into browser actions.
118 if (FeatureSwitch::script_badges()->IsEnabled()) 118 if (FeatureSwitch::script_badges()->IsEnabled())
119 return NULL; 119 return NULL;
120 return GetOrCreateOrNull(&page_actions_, extension.id(), 120 return GetOrCreateOrNull(&page_actions_, extension.id(),
121 Extension::ActionInfo::TYPE_PAGE, 121 Extension::ActionInfo::TYPE_PAGE,
122 extension.page_action_info()); 122 extension.page_action_info());
123 } 123 }
124 124
125 ExtensionAction* ExtensionActionManager::GetBrowserAction( 125 ExtensionAction* ExtensionActionManager::GetBrowserAction(
126 const extensions::Extension& extension) const { 126 const extensions::Extension& extension) const {
127 const Extension::ActionInfo* action_info = extension.browser_action_info(); 127 const Extension::ActionInfo* action_info = extension.browser_action_info();
128 Extension::ActionInfo::Type action_type = Extension::ActionInfo::TYPE_BROWSER; 128 Extension::ActionInfo::Type action_type = Extension::ActionInfo::TYPE_BROWSER;
129 if (FeatureSwitch::script_badges()->IsEnabled() && 129 if (FeatureSwitch::script_badges()->IsEnabled() &&
130 extension.page_action_info()) { 130 extension.page_action_info()) {
131 // The action box changes the meaning of the page action area, so we 131 // The action box changes the meaning of the page action area, so we
132 // need to convert page actions into browser actions. 132 // need to convert page actions into browser actions.
133 action_info = extension.page_action_info(); 133 action_info = extension.page_action_info();
134 action_type = Extension::ActionInfo::TYPE_PAGE; 134 action_type = Extension::ActionInfo::TYPE_PAGE;
135 } 135 }
136 return GetOrCreateOrNull(&browser_actions_, extension.id(), 136 return GetOrCreateOrNull(&browser_actions_, extension.id(),
137 action_type, action_info); 137 action_type, action_info);
138 } 138 }
139 139
140 ExtensionAction* ExtensionActionManager::GetSystemIndicator(
141 const extensions::Extension& extension) const {
142 return GetOrCreateOrNull(&system_indicators_, extension.id(),
143 Extension::ActionInfo::TYPE_SYSTEM_INDICATOR,
144 extension.system_indicator_info());
145 }
146
140 ExtensionAction* ExtensionActionManager::GetScriptBadge( 147 ExtensionAction* ExtensionActionManager::GetScriptBadge(
141 const extensions::Extension& extension) const { 148 const extensions::Extension& extension) const {
142 return GetOrCreateOrNull(&script_badges_, extension.id(), 149 return GetOrCreateOrNull(&script_badges_, extension.id(),
143 Extension::ActionInfo::TYPE_SCRIPT_BADGE, 150 Extension::ActionInfo::TYPE_SCRIPT_BADGE,
144 extension.script_badge_info()); 151 extension.script_badge_info());
145 } 152 }
146 153
147 } 154 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698