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

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

Issue 8221027: Make views::Label and views::Link auto-color themselves to be readable over their background colo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/canvas_skia_paint.h" 10 #include "ui/gfx/canvas_skia_paint.h"
11 #include "ui/gfx/color_utils.h"
11 #include "third_party/skia/include/effects/SkGradientShader.h" 12 #include "third_party/skia/include/effects/SkGradientShader.h"
12 #include "views/view.h" 13 #include "views/view.h"
13 14
14 InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type) 15 InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type)
15 : separator_color_(SK_ColorBLACK), 16 : separator_color_(SK_ColorBLACK),
16 top_color_(GetInfoBarTopColor(infobar_type)), 17 top_color_(GetInfoBarTopColor(infobar_type)),
17 bottom_color_(GetInfoBarBottomColor(infobar_type)) { 18 bottom_color_(GetInfoBarBottomColor(infobar_type)) {
19 SetNativeControlColor(
20 color_utils::AlphaBlend(top_color_, bottom_color_, 128));
18 } 21 }
19 22
20 InfoBarBackground::~InfoBarBackground() { 23 InfoBarBackground::~InfoBarBackground() {
21 } 24 }
22 25
23 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { 26 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
24 SkPoint gradient_points[2] = { 27 SkPoint gradient_points[2] = {
25 {SkIntToScalar(0), SkIntToScalar(0)}, 28 {SkIntToScalar(0), SkIntToScalar(0)},
26 {SkIntToScalar(0), SkIntToScalar(view->height())} 29 {SkIntToScalar(0), SkIntToScalar(view->height())}
27 }; 30 };
(...skipping 23 matching lines...) Expand all
51 // lest we get weird color bleeding problems. 54 // lest we get weird color bleeding problems.
52 paint.setAntiAlias(true); 55 paint.setAntiAlias(true);
53 canvas_skia->drawPath(infobar->stroke_path(), paint); 56 canvas_skia->drawPath(infobar->stroke_path(), paint);
54 paint.setAntiAlias(false); 57 paint.setAntiAlias(false);
55 58
56 // Now draw the separator at the bottom. 59 // Now draw the separator at the bottom.
57 canvas->FillRectInt(separator_color_, 0, 60 canvas->FillRectInt(separator_color_, 0,
58 view->height() - InfoBar::kSeparatorLineHeight, 61 view->height() - InfoBar::kSeparatorLineHeight,
59 view->width(), InfoBar::kSeparatorLineHeight); 62 view->width(), InfoBar::kSeparatorLineHeight);
60 } 63 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/confirm_infobar.cc ('k') | chrome/browser/ui/views/infobars/infobar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698