| Index: chrome/browser/ui/views/infobars/infobar_background.cc
|
| diff --git a/chrome/browser/ui/views/infobars/infobar_background.cc b/chrome/browser/ui/views/infobars/infobar_background.cc
|
| index 71fa45c835e02c4ce91b8bed2bedef6562335e62..8b66ba688083b01f9e8fac7dd2f2697a7d64e27a 100644
|
| --- a/chrome/browser/ui/views/infobars/infobar_background.cc
|
| +++ b/chrome/browser/ui/views/infobars/infobar_background.cc
|
| @@ -4,18 +4,19 @@
|
|
|
| #include "chrome/browser/ui/views/infobars/infobar_background.h"
|
|
|
| +#include "chrome/browser/ui/views/infobars/infobar_view.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/canvas.h"
|
| +#include "ui/gfx/canvas_skia_paint.h"
|
| +#include "third_party/skia/include/effects/SkGradientShader.h"
|
| #include "views/view.h"
|
|
|
| // static
|
| const int InfoBarBackground::kSeparatorLineHeight = 1;
|
|
|
| -InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type) {
|
| - gradient_background_.reset(
|
| - views::Background::CreateVerticalGradientBackground(
|
| - GetTopColor(infobar_type),
|
| - GetBottomColor(infobar_type)));
|
| +InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type)
|
| + : top_color_(GetTopColor(infobar_type)),
|
| + bottom_color_(GetBottomColor(infobar_type)) {
|
| }
|
|
|
| InfoBarBackground::~InfoBarBackground() {
|
| @@ -42,7 +43,35 @@ SkColor InfoBarBackground::GetBottomColor(InfoBarDelegate::Type infobar_type) {
|
| }
|
|
|
| void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
|
| - gradient_background_->Paint(canvas, view);
|
| + SkPoint gradient_points[2] = {
|
| + {SkIntToScalar(0), SkIntToScalar(0)},
|
| + {SkIntToScalar(0), SkIntToScalar(view->height())}
|
| + };
|
| + SkColor gradient_colors[2] = {
|
| + top_color_,
|
| + bottom_color_
|
| + };
|
| + SkShader* gradient_shader =
|
| + SkGradientShader::CreateLinear(gradient_points, gradient_colors,
|
| + NULL, 2, SkShader::kClamp_TileMode);
|
| + SkPaint paint;
|
| + paint.setStrokeWidth(SkIntToScalar(InfoBarView::kTabStrokeWidth));
|
| + paint.setStyle(SkPaint::kFill_Style);
|
| + paint.setShader(gradient_shader);
|
| + paint.setAntiAlias(true);
|
| + gradient_shader->unref();
|
| +
|
| + InfoBarView* infobar = static_cast<InfoBarView*>(view);
|
| + gfx::CanvasSkia* canvas_skia = canvas->AsCanvasSkia();
|
| + canvas_skia->drawPath(*infobar->fill_path(), paint);
|
| +
|
| + paint.setShader(NULL);
|
| + paint.setColor(SkColorSetA(ResourceBundle::toolbar_separator_color,
|
| + SkColorGetA(gradient_colors[0])));
|
| + paint.setStyle(SkPaint::kStroke_Style);
|
| + canvas_skia->drawPath(*infobar->stroke_path(), paint);
|
| +
|
| + // Now draw at the bottom.
|
| canvas->FillRectInt(ResourceBundle::toolbar_separator_color, 0,
|
| view->height() - kSeparatorLineHeight, view->width(),
|
| kSeparatorLineHeight);
|
|
|