| Index: chrome/browser/extensions/extension_action.cc
|
| diff --git a/chrome/browser/extensions/extension_action.cc b/chrome/browser/extensions/extension_action.cc
|
| index c879636cbb490c5ae87ccaced6aa544676674596..ac0187e74322cf80e0f28b0dfd48c0824bff3141 100644
|
| --- a/chrome/browser/extensions/extension_action.cc
|
| +++ b/chrome/browser/extensions/extension_action.cc
|
| @@ -50,17 +50,19 @@ class GetAttentionImageSource : public gfx::ImageSkiaSource {
|
| const gfx::ImageSkia icon_;
|
| };
|
|
|
| +template <class T>
|
| +bool HasValue(const std::map<int, T>& map, int tab_id) {
|
| + return map.find(tab_id) != map.end();
|
| +}
|
| +
|
| } // namespace
|
|
|
| const int ExtensionAction::kDefaultTabId = -1;
|
|
|
| -ExtensionAction::ExtensionAction(
|
| - const std::string& extension_id,
|
| - extensions::ActionInfo::Type action_type,
|
| - const extensions::ActionInfo& manifest_data)
|
| - : extension_id_(extension_id),
|
| - action_type_(action_type),
|
| - has_changed_(false) {
|
| +ExtensionAction::ExtensionAction(const std::string& extension_id,
|
| + extensions::ActionInfo::Type action_type,
|
| + const extensions::ActionInfo& manifest_data)
|
| + : extension_id_(extension_id), action_type_(action_type) {
|
| // Page/script actions are hidden/disabled by default, and browser actions are
|
| // visible/enabled by default.
|
| SetIsVisible(kDefaultTabId,
|
| @@ -205,6 +207,34 @@ gfx::ImageSkia ExtensionAction::GetIconWithBadge(
|
| icon.size());
|
| }
|
|
|
| +bool ExtensionAction::HasPopupUrl(int tab_id) const {
|
| + return HasValue(popup_url_, tab_id);
|
| +}
|
| +
|
| +bool ExtensionAction::HasTitle(int tab_id) const {
|
| + return HasValue(title_, tab_id);
|
| +}
|
| +
|
| +bool ExtensionAction::HasBadgeText(int tab_id) const {
|
| + return HasValue(badge_text_, tab_id);
|
| +}
|
| +
|
| +bool ExtensionAction::HasBadgeBackgroundColor(int tab_id) const {
|
| + return HasValue(badge_background_color_, tab_id);
|
| +}
|
| +
|
| +bool ExtensionAction::HasBadgeTextColor(int tab_id) const {
|
| + return HasValue(badge_text_color_, tab_id);
|
| +}
|
| +
|
| +bool ExtensionAction::HasIsVisible(int tab_id) const {
|
| + return HasValue(is_visible_, tab_id);
|
| +}
|
| +
|
| +bool ExtensionAction::HasIcon(int tab_id) const {
|
| + return HasValue(icon_, tab_id);
|
| +}
|
| +
|
| // Determines which icon would be returned by |GetIcon|, and returns its width.
|
| int ExtensionAction::GetIconWidth(int tab_id) const {
|
| // If icon has been set, return its width.
|
|
|