| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/infobars/infobar_background.h" | 5 #include "chrome/browser/ui/views/infobars/infobar_background.h" |
| 6 | 6 |
| 7 #include "chrome/browser/infobars/infobar.h" | |
| 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 7 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 9 #include "third_party/skia/include/effects/SkGradientShader.h" | 8 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 10 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 11 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
| 12 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 13 | 12 |
| 14 InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type) | 13 InfoBarBackground::InfoBarBackground(SkColor top, SkColor bottom) |
| 15 : separator_color_(SK_ColorBLACK), | 14 : separator_color_(SK_ColorBLACK), top_color_(top), bottom_color_(bottom) { |
| 16 top_color_(GetInfoBarTopColor(infobar_type)), | |
| 17 bottom_color_(GetInfoBarBottomColor(infobar_type)) { | |
| 18 SetNativeControlColor( | 15 SetNativeControlColor( |
| 19 color_utils::AlphaBlend(top_color_, bottom_color_, 128)); | 16 color_utils::AlphaBlend(top_color_, bottom_color_, 128)); |
| 20 } | 17 } |
| 21 | 18 |
| 22 InfoBarBackground::~InfoBarBackground() { | 19 InfoBarBackground::~InfoBarBackground() { |
| 23 } | 20 } |
| 24 | 21 |
| 25 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { | 22 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| 26 SkPoint gradient_points[2]; | 23 SkPoint gradient_points[2]; |
| 27 gradient_points[0].iset(0, 0); | 24 gradient_points[0].iset(0, 0); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 49 // lest we get weird color bleeding problems. | 46 // lest we get weird color bleeding problems. |
| 50 paint.setAntiAlias(true); | 47 paint.setAntiAlias(true); |
| 51 canvas_skia->drawPath(infobar->stroke_path(), paint); | 48 canvas_skia->drawPath(infobar->stroke_path(), paint); |
| 52 paint.setAntiAlias(false); | 49 paint.setAntiAlias(false); |
| 53 | 50 |
| 54 // Now draw the separator at the bottom. | 51 // Now draw the separator at the bottom. |
| 55 canvas->FillRect(gfx::Rect(0, view->height() - InfoBar::kSeparatorLineHeight, | 52 canvas->FillRect(gfx::Rect(0, view->height() - InfoBar::kSeparatorLineHeight, |
| 56 view->width(), InfoBar::kSeparatorLineHeight), | 53 view->width(), InfoBar::kSeparatorLineHeight), |
| 57 separator_color_); | 54 separator_color_); |
| 58 } | 55 } |
| OLD | NEW |