From 5132483c2e2775f0e6bcc249e1438cf88dac97a2 Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Sat, 3 Oct 2009 19:39:24 +0000 Subject: Add an API to manipulate the browser action badge. BUG=23268 Review URL: http://codereview.chromium.org/256032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27951 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/extensions/extension_action.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'chrome/common/extensions/extension_action.h') diff --git a/chrome/common/extensions/extension_action.h b/chrome/common/extensions/extension_action.h index 630671c..70ea093 100644 --- a/chrome/common/extensions/extension_action.h +++ b/chrome/common/extensions/extension_action.h @@ -10,7 +10,9 @@ #include #include "base/basictypes.h" +#include "base/scoped_ptr.h" #include "googleurl/src/gurl.h" +#include "third_party/skia/include/core/SkColor.h" class ExtensionAction { public: @@ -85,12 +87,25 @@ typedef std::map ExtensionActionMap; class ExtensionActionState { public: ExtensionActionState(std::string title, int icon_index) - : title_(title), icon_index_(icon_index) { + : title_(title), icon_index_(icon_index), + badge_background_color_(new SkColor(SkColorSetARGB(255, 218, 0, 24))) { } - std::string title() const { return title_; } + const std::string& title() const { return title_; } void set_title(const std::string& title) { title_ = title; } + const std::string& badge_text() const { return badge_text_; } + void set_badge_text(const std::string& badge_text) { + badge_text_ = badge_text; + } + + SkColor* badge_background_color() const { + return badge_background_color_.get(); + } + void set_badge_background_color(const SkColor& badge_background_color) { + badge_background_color_.reset(new SkColor(badge_background_color)); + } + int icon_index() const { return icon_index_; } void set_icon_index(int icon_index) { icon_index_ = icon_index; } @@ -101,6 +116,12 @@ class ExtensionActionState { // The icon to use. int icon_index_; + // The badge text. + std::string badge_text_; + + // The background color for the badge. + scoped_ptr badge_background_color_; + DISALLOW_COPY_AND_ASSIGN(ExtensionActionState); }; -- cgit v1.1