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 "ash/common/system/tray/tray_background_view.h" | 5 #include "ash/common/system/tray/tray_background_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 ~TrayBackground() override {} | 122 ~TrayBackground() override {} |
123 | 123 |
124 void set_color(SkColor color) { color_ = color; } | 124 void set_color(SkColor color) { color_ = color; } |
125 | 125 |
126 private: | 126 private: |
127 WmShelf* GetShelf() const { return tray_background_view_->shelf(); } | 127 WmShelf* GetShelf() const { return tray_background_view_->shelf(); } |
128 | 128 |
129 void PaintMaterial(gfx::Canvas* canvas, views::View* view) const { | 129 void PaintMaterial(gfx::Canvas* canvas, views::View* view) const { |
130 cc::PaintFlags background_flags; | 130 cc::PaintFlags background_flags; |
131 background_flags.setFlags(cc::PaintFlags::kAntiAlias_Flag); | 131 background_flags.setAntiAlias(true); |
132 background_flags.setColor(color_); | 132 background_flags.setColor(color_); |
133 gfx::Insets insets = | 133 gfx::Insets insets = |
134 GetMirroredBackgroundInsets(GetShelf()->GetAlignment()); | 134 GetMirroredBackgroundInsets(GetShelf()->GetAlignment()); |
135 gfx::Rect bounds = view->GetLocalBounds(); | 135 gfx::Rect bounds = view->GetLocalBounds(); |
136 bounds.Inset(insets); | 136 bounds.Inset(insets); |
137 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, background_flags); | 137 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, background_flags); |
138 | 138 |
139 if (draws_active_ && tray_background_view_->is_active()) { | 139 if (draws_active_ && tray_background_view_->is_active()) { |
140 cc::PaintFlags highlight_flags; | 140 cc::PaintFlags highlight_flags; |
141 highlight_flags.setFlags(cc::PaintFlags::kAntiAlias_Flag); | 141 highlight_flags.setAntiAlias(true); |
142 highlight_flags.setColor(kShelfButtonActivatedHighlightColor); | 142 highlight_flags.setColor(kShelfButtonActivatedHighlightColor); |
143 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, highlight_flags); | 143 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, highlight_flags); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 void PaintNonMaterial(gfx::Canvas* canvas, views::View* view) const { | 147 void PaintNonMaterial(gfx::Canvas* canvas, views::View* view) const { |
148 const static int kImageTypeDefault = 0; | 148 const static int kImageTypeDefault = 0; |
149 // TODO(estade): leftover type which should be removed along with the rest | 149 // TODO(estade): leftover type which should be removed along with the rest |
150 // of pre-MD code. | 150 // of pre-MD code. |
151 // const static int kImageTypeOnBlack = 1; | 151 // const static int kImageTypeOnBlack = 1; |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 } | 614 } |
615 | 615 |
616 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { | 616 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { |
617 gfx::Insets insets = GetBackgroundInsets(); | 617 gfx::Insets insets = GetBackgroundInsets(); |
618 gfx::Rect bounds = GetLocalBounds(); | 618 gfx::Rect bounds = GetLocalBounds(); |
619 bounds.Inset(insets); | 619 bounds.Inset(insets); |
620 return bounds; | 620 return bounds; |
621 } | 621 } |
622 | 622 |
623 } // namespace ash | 623 } // namespace ash |
OLD | NEW |