Index: ash/common/system/tray/tray_background_view.cc |
diff --git a/ash/common/system/tray/tray_background_view.cc b/ash/common/system/tray/tray_background_view.cc |
index 3e26c5069993d2872ef9ae0d0f4602002b223bb3..569e939369e26c480a368488596996bd1150bdf7 100644 |
--- a/ash/common/system/tray/tray_background_view.cc |
+++ b/ash/common/system/tray/tray_background_view.cc |
@@ -89,19 +89,26 @@ |
const static int kNumOrientations = 2; |
explicit TrayBackground(TrayBackgroundView* tray_background_view) |
- : tray_background_view_(tray_background_view), alpha_(0) {} |
+ : tray_background_view_(tray_background_view) {} |
~TrayBackground() override {} |
- |
- void set_alpha(int alpha) { alpha_ = alpha; } |
private: |
WmShelf* GetShelf() const { return tray_background_view_->shelf(); } |
void PaintMaterial(gfx::Canvas* canvas, views::View* view) const { |
+ SkColor background_color = SK_ColorTRANSPARENT; |
+ if (GetShelf()->GetBackgroundType() == |
+ ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT) { |
+ background_color = SkColorSetA(kShelfBaseColor, |
+ GetShelfConstant(SHELF_BACKGROUND_ALPHA)); |
+ } |
+ |
+ // TODO(bruthig|tdanderson): The background should be changed using a |
+ // fade in/out animation. |
SkPaint background_paint; |
background_paint.setFlags(SkPaint::kAntiAlias_Flag); |
- background_paint.setColor(SkColorSetA(kShelfBaseColor, alpha_)); |
+ background_paint.setColor(background_color); |
canvas->DrawRoundRect(view->GetLocalBounds(), kTrayRoundedBorderRadius, |
background_paint); |
@@ -157,8 +164,6 @@ |
// Reference to the TrayBackgroundView for which this is a background. |
TrayBackgroundView* tray_background_view_; |
- |
- int alpha_; |
DISALLOW_COPY_AND_ASSIGN(TrayBackground); |
}; |
@@ -352,6 +357,13 @@ |
} |
} |
ActionableView::OnGestureEvent(event); |
+} |
+ |
+void TrayBackgroundView::UpdateBackground(int alpha) { |
+ // The animator should never fire when the alternate shelf layout is used. |
+ if (!background_ || draw_background_as_active_) |
+ return; |
+ SchedulePaint(); |
} |
void TrayBackgroundView::SetContents(views::View* contents) { |
@@ -498,11 +510,4 @@ |
// Nothing to do here. |
} |
-void TrayBackgroundView::UpdateShelfItemBackground(int alpha) { |
- if (background_) { |
- background_->set_alpha(alpha); |
- SchedulePaint(); |
- } |
-} |
- |
} // namespace ash |