diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-20 20:13:24 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-20 20:13:24 +0000 |
commit | 7668bfe1f7605715c9d72568fde4de5e66534915 (patch) | |
tree | e90e0aff89ad26a21a13656ddfa97f572c0c8395 /chrome/common | |
parent | 95dd38fd658dd0eef530b3171b641f4a8bf5a224 (diff) | |
download | chromium_src-7668bfe1f7605715c9d72568fde4de5e66534915.zip chromium_src-7668bfe1f7605715c9d72568fde4de5e66534915.tar.gz chromium_src-7668bfe1f7605715c9d72568fde4de5e66534915.tar.bz2 |
Revert "Revert 29457, because this is making ExtensionBrowserTest.PageAction crash on Vista"
Original description:
Implement badges for page actions. Also add badge text color API.
Also change color APIs from wanting ARGB to RGBA.
BUG=24635
BUG=24644
BUG=25215
Review URL: http://codereview.chromium.org/293031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/extensions/extension_action.cc | 4 | ||||
-rw-r--r-- | chrome/common/extensions/extension_action.h | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/chrome/common/extensions/extension_action.cc b/chrome/common/extensions/extension_action.cc index 13ee202..de15f17 100644 --- a/chrome/common/extensions/extension_action.cc +++ b/chrome/common/extensions/extension_action.cc @@ -20,7 +20,7 @@ ExtensionAction::~ExtensionAction() { } void ExtensionActionState::PaintBadge(gfx::Canvas* canvas, - const gfx::Rect& bounds) { + const gfx::Rect& bounds) const { const std::string& text = badge_text(); if (text.empty()) return; @@ -49,7 +49,7 @@ void ExtensionActionState::PaintBadge(gfx::Canvas* canvas, SkTypeface* typeface = SkTypeface::CreateFromName("Arial", SkTypeface::kBold); SkPaint text_paint; text_paint.setAntiAlias(true); - text_paint.setColor(SK_ColorWHITE); + text_paint.setColor(badge_text_color()); text_paint.setFakeBoldText(true); text_paint.setTextAlign(SkPaint::kLeft_Align); text_paint.setTextSize(SkIntToScalar(kTextSize)); diff --git a/chrome/common/extensions/extension_action.h b/chrome/common/extensions/extension_action.h index 6decdd4..b819edb 100644 --- a/chrome/common/extensions/extension_action.h +++ b/chrome/common/extensions/extension_action.h @@ -84,7 +84,8 @@ class ExtensionActionState { public: ExtensionActionState(std::string title, int icon_index) : hidden_(false), title_(title), icon_index_(icon_index), - badge_background_color_(SkColorSetARGB(255, 218, 0, 24)) { + badge_background_color_(SkColorSetARGB(255, 218, 0, 24)), + badge_text_color_(SK_ColorWHITE) { } const std::string& title() const { return title_; } @@ -102,6 +103,13 @@ class ExtensionActionState { badge_background_color_ = badge_background_color; } + SkColor badge_text_color() const { + return badge_text_color_; + } + void set_badge_text_color(SkColor badge_text_color) { + badge_text_color_ = badge_text_color; + } + int icon_index() const { return icon_index_; } void set_icon_index(int icon_index) { icon_index_ = icon_index; } @@ -111,7 +119,7 @@ class ExtensionActionState { bool hidden() const { return hidden_; } void set_hidden(bool hidden) { hidden_ = hidden; } - void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds); + void PaintBadge(gfx::Canvas* canvas, const gfx::Rect& bounds) const; private: // True if the action is in the hidden state. @@ -132,6 +140,9 @@ class ExtensionActionState { // The background color for the badge. SkColor badge_background_color_; + // The text color for the badge. + SkColor badge_text_color_; + DISALLOW_COPY_AND_ASSIGN(ExtensionActionState); }; |