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

Unified Diff: chrome/browser/ui/omnibox/location_bar_util.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: Call the right superclass method Created 8 years, 3 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/browser/ui/omnibox/location_bar_util.cc
diff --git a/chrome/browser/ui/omnibox/location_bar_util.cc b/chrome/browser/ui/omnibox/location_bar_util.cc
index c5aeccacfe0ecf4aaa0d383ae561118ea113e2f4..7bbb5ec573dc888dd14d4b904d16b464c65a3497 100644
--- a/chrome/browser/ui/omnibox/location_bar_util.cc
+++ b/chrome/browser/ui/omnibox/location_bar_util.cc
@@ -6,7 +6,13 @@
#include "base/i18n/rtl.h"
#include "base/string_util.h"
+#include "chrome/common/extensions/extension_action.h"
+#include "third_party/skia/include/core/SkPaint.h"
+#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/base/text/text_elider.h"
+#include "ui/gfx/canvas.h"
+#include "ui/gfx/color_utils.h"
+#include "ui/gfx/rect.h"
namespace location_bar_util {
@@ -26,4 +32,41 @@ string16 CalculateMinString(const string16& description) {
return min_string;
}
+
+void PaintExtensionActionBackground(const ExtensionAction& action,
+ int tab_id,
+ gfx::Canvas* canvas,
+ const gfx::Rect& bounds,
+ SkColor text_color,
+ SkColor background_color) {
+ if (!action.WantsAttention(tab_id))
+ return;
+
+ SkPoint gradient_bounds[2] = { {SkIntToScalar(bounds.x()),
+ SkIntToScalar(bounds.y())},
+ {SkIntToScalar(bounds.x()),
+ SkIntToScalar(bounds.bottom())} };
+ SkColor gradient_colors[2] = {
+ color_utils::AlphaBlend(text_color, background_color, 0x13),
+ color_utils::AlphaBlend(text_color, background_color, 0x1d)
+ };
+ SkShader* gradient = SkGradientShader::CreateLinear(
+ gradient_bounds, gradient_colors, NULL, 2, SkShader::kClamp_TileMode);
+ SkPaint paint;
+ paint.setShader(gradient);
+ gradient->unref();
+ canvas->DrawRect(bounds, paint);
+
+ SkColor border_color =
+ color_utils::AlphaBlend(text_color, background_color, 0x55);
+ canvas->DrawLine(bounds.origin(),
+ gfx::Point(bounds.x(), bounds.bottom()),
+ border_color);
+ // "-1" because gfx::Rects are half-open, not including their right or
+ // bottom edges.
+ canvas->DrawLine(gfx::Point(bounds.right() - 1, bounds.y()),
+ gfx::Point(bounds.right() - 1, bounds.bottom()),
+ border_color);
+}
+
} // namespace location_bar_util
« no previous file with comments | « chrome/browser/ui/omnibox/location_bar_util.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698