Chromium Code Reviews| Index: ash/system/tray/tray_background_view.cc |
| diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc |
| index 28a3764ba5d703467f2f117c0e850de95759b69d..84bb44a9d6bc2a8a1c93ff1a54176a151503a370 100644 |
| --- a/ash/system/tray/tray_background_view.cc |
| +++ b/ash/system/tray/tray_background_view.cc |
| @@ -97,29 +97,24 @@ class TrayBackground : public views::Background { |
| const static int kImageVertical = 1; |
| const static int kNumOrientations = 2; |
| - explicit TrayBackground(TrayBackgroundView* tray_background_view) : |
| - tray_background_view_(tray_background_view) { |
| - } |
| + explicit TrayBackground(TrayBackgroundView* tray_background_view) |
| + : tray_background_view_(tray_background_view), alpha_(0) {} |
| ~TrayBackground() override {} |
| + void set_alpha(int alpha) { alpha_ = alpha; } |
| + |
| private: |
| ShelfWidget* GetShelfWidget() const { |
| return tray_background_view_->GetShelfLayoutManager()->shelf_widget(); |
| } |
| void PaintMaterial(gfx::Canvas* canvas, views::View* view) const { |
| - SkColor color = SK_ColorTRANSPARENT; |
| - ShelfWidget* shelf_widget = GetShelfWidget(); |
| + SkColor color = SkColorSetA(kShelfBaseColor, alpha_); |
| if (tray_background_view_->draw_background_as_active()) { |
| // TODO(bruthig|mohsen): Use of this color is temporary. Draw the active |
| // state using the material design ripple animation. |
| color = SK_ColorBLUE; |
| - } else if (shelf_widget && |
| - shelf_widget->GetBackgroundType() == |
| - ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT) { |
| - color = SkColorSetA(kShelfBaseColor, |
| - GetShelfConstant(SHELF_BACKGROUND_ALPHA)); |
| } |
| // TODO(bruthig|tdanderson): The background should be changed using a |
| @@ -176,6 +171,8 @@ class TrayBackground : public views::Background { |
| // Reference to the TrayBackgroundView for which this is a background. |
| TrayBackgroundView* tray_background_view_; |
| + int alpha_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(TrayBackground); |
| }; |
| @@ -378,13 +375,6 @@ void TrayBackgroundView::OnGestureEvent(ui::GestureEvent* event) { |
| ActionableView::OnGestureEvent(event); |
| } |
| -void TrayBackgroundView::UpdateBackground(int alpha) { |
| - // The animator should never fire when the alternate shelf layout is used. |
|
James Cook
2016/06/14 17:50:02
Hooray for eliminating old "alternate shelf layout
|
| - if (!background_ || draw_background_as_active_) |
| - return; |
| - SchedulePaint(); |
| -} |
| - |
| void TrayBackgroundView::SetContents(views::View* contents) { |
| SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| AddChildView(contents); |
| @@ -573,4 +563,10 @@ void TrayBackgroundView::UpdateBubbleViewArrow( |
| // Nothing to do here. |
| } |
| +void TrayBackgroundView::UpdateShelfItemBackground(int alpha) { |
| + if (background_) |
| + background_->set_alpha(alpha); |
| + SchedulePaint(); |
| +} |
| + |
| } // namespace ash |