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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_background.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/infobars/infobar.h"
8 #include "chrome/browser/ui/views/infobars/infobar_view.h" 8 #include "chrome/browser/ui/views/infobars/infobar_view.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
11 #include "ui/gfx/color_utils.h" 11 #include "ui/gfx/color_utils.h"
12 #include "ui/views/view.h" 12 #include "ui/views/view.h"
13 13
14 InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type) 14 InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type)
15 : separator_color_(SK_ColorBLACK), 15 : separator_color_(SK_ColorBLACK),
16 top_color_(GetInfoBarTopColor(infobar_type)), 16 top_color_(InfoBar::GetTopColor(infobar_type)),
17 bottom_color_(GetInfoBarBottomColor(infobar_type)) { 17 bottom_color_(InfoBar::GetBottomColor(infobar_type)) {
18 SetNativeControlColor( 18 SetNativeControlColor(
19 color_utils::AlphaBlend(top_color_, bottom_color_, 128)); 19 color_utils::AlphaBlend(top_color_, bottom_color_, 128));
20 } 20 }
21 21
22 InfoBarBackground::~InfoBarBackground() { 22 InfoBarBackground::~InfoBarBackground() {
23 } 23 }
24 24
25 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { 25 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
26 SkPoint gradient_points[2]; 26 SkPoint gradient_points[2];
27 gradient_points[0].iset(0, 0); 27 gradient_points[0].iset(0, 0);
(...skipping 21 matching lines...) Expand all
49 // lest we get weird color bleeding problems. 49 // lest we get weird color bleeding problems.
50 paint.setAntiAlias(true); 50 paint.setAntiAlias(true);
51 canvas_skia->drawPath(infobar->stroke_path(), paint); 51 canvas_skia->drawPath(infobar->stroke_path(), paint);
52 paint.setAntiAlias(false); 52 paint.setAntiAlias(false);
53 53
54 // Now draw the separator at the bottom. 54 // Now draw the separator at the bottom.
55 canvas->FillRect(gfx::Rect(0, view->height() - InfoBar::kSeparatorLineHeight, 55 canvas->FillRect(gfx::Rect(0, view->height() - InfoBar::kSeparatorLineHeight,
56 view->width(), InfoBar::kSeparatorLineHeight), 56 view->width(), InfoBar::kSeparatorLineHeight),
57 separator_color_); 57 separator_color_);
58 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698