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

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: 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
« no previous file with comments | « ash/common/shelf/app_list_button.h ('k') | ash/common/shelf/overflow_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7781625be42f4dcf1ec8efdc890ac578b2477da5..e31acdf85f0f02fcbe47d827aef833cfd177de0e 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);
}
« no previous file with comments | « ash/common/shelf/app_list_button.h ('k') | ash/common/shelf/overflow_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698