| 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/ui/infobar_container_delegate.h" | 7 #include "chrome/browser/ui/infobar_container_delegate.h" |
| 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 8 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 10 #include "ui/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
| 11 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
| 12 #include "ui/gfx/scoped_canvas.h" | 12 #include "ui/gfx/scoped_canvas.h" |
| 13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 14 | 14 |
| 15 InfoBarBackground::InfoBarBackground( | 15 InfoBarBackground::InfoBarBackground( |
| 16 infobars::InfoBarDelegate::Type infobar_type) { | 16 infobars::InfoBarDelegate::Type infobar_type) { |
| 17 SetNativeControlColor(infobars::InfoBar::GetTopColor(infobar_type)); | 17 SetNativeControlColor(infobars::InfoBar::GetBackgroundColor(infobar_type)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 InfoBarBackground::~InfoBarBackground() { | 20 InfoBarBackground::~InfoBarBackground() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { | 23 void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| 24 InfoBarView* infobar = static_cast<InfoBarView*>(view); | 24 InfoBarView* infobar = static_cast<InfoBarView*>(view); |
| 25 const infobars::InfoBarContainer::Delegate* delegate = | 25 const infobars::InfoBarContainer::Delegate* delegate = |
| 26 infobar->container_delegate(); | 26 infobar->container_delegate(); |
| 27 SkPath stroke_path, fill_path; | 27 SkPath stroke_path, fill_path; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 canvas->DrawPath(stroke_path, stroke); | 77 canvas->DrawPath(stroke_path, stroke); |
| 78 | 78 |
| 79 // Bottom separator. | 79 // Bottom separator. |
| 80 stroke.setAntiAlias(false); | 80 stroke.setAntiAlias(false); |
| 81 gfx::SizeF view_size_px = gfx::ScaleSize(gfx::SizeF(view->size()), dsf); | 81 gfx::SizeF view_size_px = gfx::ScaleSize(gfx::SizeF(view->size()), dsf); |
| 82 SkScalar y = SkIntToScalar(view_size_px.height() - kSeparatorThicknessPx) + | 82 SkScalar y = SkIntToScalar(view_size_px.height() - kSeparatorThicknessPx) + |
| 83 SK_ScalarHalf; | 83 SK_ScalarHalf; |
| 84 SkScalar w = SkFloatToScalar(view_size_px.width()); | 84 SkScalar w = SkFloatToScalar(view_size_px.width()); |
| 85 canvas->sk_canvas()->drawLine(0, y, w, y, stroke); | 85 canvas->sk_canvas()->drawLine(0, y, w, y, stroke); |
| 86 } | 86 } |
| OLD | NEW |