| 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
|
|
|