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 569e939369e26c480a368488596996bd1150bdf7..ec21dc8556cb3aa9603dad36479a9c5593184b0a 100644 |
--- a/ash/common/system/tray/tray_background_view.cc |
+++ b/ash/common/system/tray/tray_background_view.cc |
@@ -89,26 +89,19 @@ class TrayBackground : public views::Background { |
const static int kNumOrientations = 2; |
explicit TrayBackground(TrayBackgroundView* tray_background_view) |
- : tray_background_view_(tray_background_view) {} |
+ : tray_background_view_(tray_background_view), alpha_(0) {} |
~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(background_color); |
+ background_paint.setColor(SkColorSetA(kShelfBaseColor, alpha_)); |
canvas->DrawRoundRect(view->GetLocalBounds(), kTrayRoundedBorderRadius, |
background_paint); |
@@ -165,6 +158,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); |
}; |
@@ -359,13 +354,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. |
- 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); |
@@ -510,4 +498,10 @@ void TrayBackgroundView::UpdateBubbleViewArrow( |
// Nothing to do here. |
} |
+void TrayBackgroundView::UpdateShelfItemBackground(int alpha) { |
+ if (background_) |
+ background_->set_alpha(alpha); |
+ SchedulePaint(); |
James Cook
2016/07/27 00:30:39
This is probably fine, but does it need to Schedul
bruthig
2016/07/27 17:05:45
Nope, changed.
|
+} |
+ |
} // namespace ash |