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

Unified Diff: chrome/browser/extensions/extension_action.cc

Issue 186013003: Persist browseraction properties across restarts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_action.h ('k') | chrome/browser/extensions/state_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/browser/extensions/extension_action.h ('k') | chrome/browser/extensions/state_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698