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

Unified Diff: chrome/common/badge_util.cc

Issue 1214243003: [Extensions UI] Clean up extension icon generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/skia/ImageSkia Created 5 years, 5 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/badge_util.cc
diff --git a/chrome/common/badge_util.cc b/chrome/common/badge_util.cc
index bf295917b6100f80af619e264d6a2792a621ed60..66497dbdd9239433c44049759373ac7ddb231d85 100644
--- a/chrome/common/badge_util.cc
+++ b/chrome/common/badge_util.cc
@@ -20,33 +20,24 @@
namespace {
// Different platforms need slightly different constants to look good.
+// TODO(devlin): Comb through these and see if they are all still needed/
+// appropriate.
#if defined(OS_WIN)
const float kTextSize = 10;
-const int kBottomMarginBrowserAction = 0;
-const int kBottomMarginPageAction = 2;
-const int kPadding = 2;
// The padding between the top of the badge and the top of the text.
const int kTopTextPadding = -1;
#elif defined(OS_MACOSX)
const float kTextSize = 9.0;
-const int kBottomMarginBrowserAction = 5;
-const int kBottomMarginPageAction = 2;
-const int kPadding = 2;
const int kTopTextPadding = 0;
#elif defined(OS_CHROMEOS)
const float kTextSize = 8.0;
-const int kBottomMarginBrowserAction = 0;
-const int kBottomMarginPageAction = 2;
-const int kPadding = 2;
const int kTopTextPadding = 1;
#elif defined(OS_POSIX)
const float kTextSize = 9.0;
-const int kBottomMarginBrowserAction = 0;
-const int kBottomMarginPageAction = 2;
-const int kPadding = 2;
const int kTopTextPadding = 0;
#endif
+const int kPadding = 2;
const int kBadgeHeight = 11;
const int kMaxTextWidth = 23;
@@ -99,8 +90,7 @@ void PaintBadge(gfx::Canvas* canvas,
const std::string& text,
const SkColor& text_color_in,
const SkColor& background_color_in,
- int icon_width,
- extensions::ActionInfo::Type action_type) {
+ int icon_width) {
if (text.empty())
return;
@@ -146,10 +136,7 @@ void PaintBadge(gfx::Canvas* canvas,
// Paint the badge background color in the right location. It is usually
// right-aligned, but it can also be center-aligned if it is large.
int rect_height = kBadgeHeight;
- int bottom_margin =
- action_type == extensions::ActionInfo::TYPE_BROWSER ?
- kBottomMarginBrowserAction : kBottomMarginPageAction;
- int rect_y = bounds.bottom() - bottom_margin - kBadgeHeight;
+ int rect_y = bounds.bottom() - kBadgeHeight;
int rect_width = badge_width;
int rect_x = (badge_width >= kCenterAlignThreshold) ?
bounds.x() + (bounds.width() - badge_width) / 2 :

Powered by Google App Engine
This is Rietveld 408576698