Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1700)

Unified Diff: ash/common/system/tray/tray_background_view.cc

Issue 2191153002: Revert of Replaced BackgroundAnimator with ShelfBackgroundAnimator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « ash/common/system/tray/tray_background_view.h ('k') | ash/common/test/material_design_controller_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698