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

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

Issue 2053113002: Replaced BackgroundAnimator with ShelfBackgroundAnimator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into animate_shelf_chip_backgrounds 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 569e939369e26c480a368488596996bd1150bdf7..3e26c5069993d2872ef9ae0d0f4602002b223bb3 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,11 @@ void TrayBackgroundView::UpdateBubbleViewArrow(
// 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