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" |
7 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
8 #include "third_party/skia/include/effects/SkGradientShader.h" | 9 #include "third_party/skia/include/effects/SkGradientShader.h" |
9 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/color_utils.h" | 11 #include "ui/gfx/color_utils.h" |
11 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
12 | 13 |
13 InfoBarBackground::InfoBarBackground(SkColor top, SkColor bottom) | 14 InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type) |
14 : separator_color_(SK_ColorBLACK), top_color_(top), bottom_color_(bottom) { | 15 : separator_color_(SK_ColorBLACK), |
| 16 top_color_(GetInfoBarTopColor(infobar_type)), |
| 17 bottom_color_(GetInfoBarBottomColor(infobar_type)) { |
15 SetNativeControlColor( | 18 SetNativeControlColor( |
16 color_utils::AlphaBlend(top_color_, bottom_color_, 128)); | 19 color_utils::AlphaBlend(top_color_, bottom_color_, 128)); |
17 } | 20 } |
18 | 21 |
19 InfoBarBackground::~InfoBarBackground() { | 22 InfoBarBackground::~InfoBarBackground() { |
20 } | 23 } |
21 | 24 |
22 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { | 25 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
23 SkPoint gradient_points[2]; | 26 SkPoint gradient_points[2]; |
24 gradient_points[0].iset(0, 0); | 27 gradient_points[0].iset(0, 0); |
(...skipping 21 matching lines...) Expand all Loading... |
46 // lest we get weird color bleeding problems. | 49 // lest we get weird color bleeding problems. |
47 paint.setAntiAlias(true); | 50 paint.setAntiAlias(true); |
48 canvas_skia->drawPath(infobar->stroke_path(), paint); | 51 canvas_skia->drawPath(infobar->stroke_path(), paint); |
49 paint.setAntiAlias(false); | 52 paint.setAntiAlias(false); |
50 | 53 |
51 // Now draw the separator at the bottom. | 54 // Now draw the separator at the bottom. |
52 canvas->FillRect(gfx::Rect(0, view->height() - InfoBar::kSeparatorLineHeight, | 55 canvas->FillRect(gfx::Rect(0, view->height() - InfoBar::kSeparatorLineHeight, |
53 view->width(), InfoBar::kSeparatorLineHeight), | 56 view->width(), InfoBar::kSeparatorLineHeight), |
54 separator_color_); | 57 separator_color_); |
55 } | 58 } |
OLD | NEW |