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

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

Issue 10834279: Give request-to-act badges a grey background, and increase spacing to make it fit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add Views UI; clean up GTK Created 8 years, 4 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
Index: chrome/common/extensions/extension_action.cc
diff --git a/chrome/common/extensions/extension_action.cc b/chrome/common/extensions/extension_action.cc
index b2bef14906d110b257e207c05b482a0562204557..074f649719d86a793e23d3aa06a417130059cbb4 100644
--- a/chrome/common/extensions/extension_action.cc
+++ b/chrome/common/extensions/extension_action.cc
@@ -191,6 +191,12 @@ class ExtensionAction::IconWithBadgeImageSource
const int ExtensionAction::kDefaultTabId = -1;
+const SkColor ExtensionAction::kGetAttentionBorderColor =
Peter Kasting 2012/08/24 23:08:28 You need to get the correct colors from the themin
Jeffrey Yasskin 2012/08/29 00:37:50 Oh good. I'll figure out how to do this after send
+ SkColorSetRGB(0xAA, 0xAA, 0xAA);
+const SkColor ExtensionAction::kGetAttentionBackgroundTopColor =
+ SkColorSetRGB(0xEC, 0xEC, 0xEC);
+const SkColor ExtensionAction::kGetAttentionBackgroundBottomColor =
+ SkColorSetRGB(0xE2, 0xE2, 0xE2);
ExtensionAction::IconAnimation::IconAnimation(
ui::AnimationDelegate* delegate)
@@ -370,6 +376,28 @@ void ExtensionAction::ClearAllValuesForTab(int tab_id) {
icon_animation_.erase(tab_id);
}
+void ExtensionAction::PaintBackground(gfx::Canvas* canvas,
+ const gfx::Rect& bounds,
+ int tab_id) {
+ if (WantsAttention(tab_id)) {
+ SkPoint gradient_bounds[2] = { {SkIntToScalar(bounds.x()),
+ SkIntToScalar(bounds.y() + 1)},
Peter Kasting 2012/08/24 23:08:28 Nit: Once you've defined LocationBar::kVisibleEdge
Jeffrey Yasskin 2012/08/29 00:37:50 This isn't necessarily the thickness of the locati
+ {SkIntToScalar(bounds.x()),
+ SkIntToScalar(bounds.bottom() - 1)} };
+ SkColor gradient_colors[2] = { kGetAttentionBackgroundTopColor,
+ kGetAttentionBackgroundBottomColor };
+ SkShader* gradient = SkGradientShader::CreateLinear(
+ gradient_bounds, gradient_colors, NULL, 2, SkShader::kClamp_TileMode);
+ SkPaint paint;
+ paint.setShader(gradient);
+ gradient->unref();
+ gfx::Rect bg_rect(bounds.x() - 1, bounds.y(),
Peter Kasting 2012/08/24 23:08:28 Why do we draw outside our bounds? Shouldn't our
Jeffrey Yasskin 2012/08/29 00:37:50 I think this came from before I had the platform-s
+ bounds.width() + 1, bounds.height() - 1);
Peter Kasting 2012/08/24 23:08:28 What's this last -1 mean?
Jeffrey Yasskin 2012/08/29 00:37:50 This also came from before I got the platform-spec
+ canvas->DrawRect(bg_rect, paint);
+ canvas->DrawRect(bg_rect, kGetAttentionBorderColor);
+ }
+}
+
void ExtensionAction::PaintBadge(gfx::Canvas* canvas,
const gfx::Rect& bounds,
int tab_id) {
« chrome/common/extensions/extension_action.h ('K') | « chrome/common/extensions/extension_action.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698