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

Unified Diff: ash/common/shelf/app_list_button.cc

Issue 2053113002: Replaced BackgroundAnimator with ShelfBackgroundAnimator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added PaletteTray to the Shelf background animations. 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/shelf/app_list_button.cc
diff --git a/ash/common/shelf/app_list_button.cc b/ash/common/shelf/app_list_button.cc
index db39d21c0c7805c6c23d56904a1e2cc96fd43308..5438320695691c8ef7fa6dedcd055c7361155da4 100644
--- a/ash/common/shelf/app_list_button.cc
+++ b/ash/common/shelf/app_list_button.cc
@@ -35,6 +35,7 @@ AppListButton::AppListButton(InkDropButtonListener* listener,
WmShelf* wm_shelf)
: views::ImageButton(nullptr),
draw_background_as_active_(false),
+ background_alpha_(0),
listener_(listener),
shelf_view_(shelf_view),
wm_shelf_(wm_shelf) {
@@ -73,6 +74,11 @@ void AppListButton::OnAppListDismissed() {
SchedulePaint();
}
+void AppListButton::SetBackgroundAlpha(int alpha) {
+ background_alpha_ = alpha;
+ SchedulePaint();
+}
+
bool AppListButton::OnMousePressed(const ui::MouseEvent& event) {
ImageButton::OnMousePressed(event);
shelf_view_->PointerPressedOnButton(this, ShelfView::MOUSE, event);
@@ -157,22 +163,16 @@ void AppListButton::OnPaint(gfx::Canvas* canvas) {
}
void AppListButton::PaintBackgroundMD(gfx::Canvas* canvas) {
- SkPaint background_paint;
- background_paint.setColor(SK_ColorTRANSPARENT);
- background_paint.setFlags(SkPaint::kAntiAlias_Flag);
- background_paint.setStyle(SkPaint::kFill_Style);
-
- if (wm_shelf_->GetBackgroundType() ==
- ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT) {
- background_paint.setColor(
- SkColorSetA(kShelfBaseColor, GetShelfConstant(SHELF_BACKGROUND_ALPHA)));
- }
-
// Paint the circular background of AppList button.
gfx::Point circle_center = GetContentsBounds().CenterPoint();
if (!IsHorizontalAlignment(wm_shelf_->GetAlignment()))
circle_center = gfx::Point(circle_center.y(), circle_center.x());
+ SkPaint background_paint;
+ background_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_));
+ background_paint.setFlags(SkPaint::kAntiAlias_Flag);
+ background_paint.setStyle(SkPaint::kFill_Style);
+
canvas->DrawCircle(circle_center, kAppListButtonRadius, background_paint);
}

Powered by Google App Engine
This is Rietveld 408576698