Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| index 423a35ded026a266405cc9d08a617d387251c25f..5559a44c6a80f2ae4911d2edf01351db0ebbdf84 100644 |
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| @@ -161,6 +161,11 @@ LocationBarView::LocationBarView(Browser* browser, |
| ui_zoom::ZoomEventManager::GetForBrowserContext(profile) |
| ->AddZoomEventManagerObserver(this); |
| + if (ui::MaterialDesignController::IsModeMaterial()) { |
|
Peter Kasting
2015/10/19 21:09:44
Nit: Blank line above.
jonross
2015/10/20 18:54:53
Done.
|
| + set_background(views::Background::CreateSolidScaledBackground( |
| + GetColor(SecurityStateModel::NONE, BACKGROUND), |
| + SkColorSetARGB(0x4D, 0x00, 0x00, 0x00), !is_popup_mode_)); |
| + } |
| } |
| LocationBarView::~LocationBarView() { |
| @@ -1250,6 +1255,10 @@ void LocationBarView::OnFocus() { |
| void LocationBarView::OnPaint(gfx::Canvas* canvas) { |
| View::OnPaint(canvas); |
| + // SolidScaledBackground is used in Material Design |
|
Peter Kasting
2015/10/19 21:09:44
Nit: Comments should have periods.
Maybe this:
jonross
2015/10/20 18:54:53
Done.
|
| + if (ui::MaterialDesignController::IsModeMaterial()) |
| + return; |
| + |
| // Fill the location bar background color behind the border. Parts of the |
| // border images are meant to rest atop the toolbar background and parts atop |
| // the omnibox background, so we can't just blindly fill our entire bounds. |
| @@ -1282,36 +1291,18 @@ void LocationBarView::PaintChildren(const ui::PaintContext& context) { |
| if (show_focus_rect_ && HasFocus()) |
| recorder.canvas()->DrawFocusRect(omnibox_view_->bounds()); |
| + // SolidScaledBackground used for Material Design |
|
Peter Kasting
2015/10/19 21:09:44
See above
jonross
2015/10/20 18:54:53
Done.
|
| + if (ui::MaterialDesignController::IsModeMaterial()) |
| + return; |
| + |
| // Maximized popup windows don't draw the horizontal edges. We implement this |
| // by simply expanding the paint area outside the view by the edge thickness. |
| gfx::Rect border_rect(GetContentsBounds()); |
| if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) |
| border_rect.Inset(-kPopupEdgeThickness, 0); |
| - if (ui::MaterialDesignController::IsModeMaterial()) { |
| - gfx::Canvas* canvas = recorder.canvas(); |
| - const float scale = canvas->SaveAndUnscale(); |
| - |
| - SkPaint paint; |
| - paint.setStyle(SkPaint::Style::kStroke_Style); |
| - paint.setColor(SkColorSetARGB(0x40, 0x00, 0x00, 0x00)); |
| - paint.setStrokeWidth(1); |
| - paint.setAntiAlias(true); |
| - |
| - const float kOffset = 0.5f; |
| - gfx::RectF border_rect_f(border_rect); |
| - border_rect_f.Scale(scale); |
| - gfx::InsetsF insets(kOffset, kOffset, kOffset, kOffset); |
| - border_rect_f.Inset(insets); |
| - |
| - const SkScalar kCornerRadius = SkDoubleToScalar(2.5f * scale); |
| - canvas->sk_canvas()->drawRoundRect(gfx::RectFToSkRect(border_rect_f), |
| - kCornerRadius, kCornerRadius, paint); |
| - recorder.canvas()->Restore(); |
| - } else { |
| - views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
| - border_rect); |
| - } |
| + views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
| + border_rect); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |