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

Side by Side Diff: ash/shelf/shelf_button.cc

Issue 2070143003: Add MD ink drop ripple to app list button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b612539_shelf_button_ripple
Patch Set: Addressed review comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/shelf/shelf_button.h" 5 #include "ash/shelf/shelf_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 const SkColor kIndicatorColor = SK_ColorWHITE; 47 const SkColor kIndicatorColor = SK_ColorWHITE;
48 48
49 // Canvas scale to ensure that the activity indicator is not pixelated even at 49 // Canvas scale to ensure that the activity indicator is not pixelated even at
50 // the highest possible device scale factors. 50 // the highest possible device scale factors.
51 const int kIndicatorCanvasScale = 5; 51 const int kIndicatorCanvasScale = 5;
52 52
53 // Shelf item ripple constants. 53 // Shelf item ripple constants.
54 const int kInkDropSmallSize = 48; 54 const int kInkDropSmallSize = 48;
55 const int kInkDropLargeSize = 60; 55 const int kInkDropLargeSize = 60;
56 const int kInkDropLargeCornerRadius = 4; 56 const int kInkDropLargeCornerRadius = 4;
57 const SkColor kInkDropBaseColor = SK_ColorWHITE;
58 57
59 // Paints an activity indicator on |canvas| whose |size| is specified in DIP. 58 // Paints an activity indicator on |canvas| whose |size| is specified in DIP.
60 void PaintIndicatorOnCanvas(gfx::Canvas* canvas, const gfx::Size& size) { 59 void PaintIndicatorOnCanvas(gfx::Canvas* canvas, const gfx::Size& size) {
61 SkPaint paint; 60 SkPaint paint;
62 paint.setColor(kIndicatorColor); 61 paint.setColor(kIndicatorColor);
63 paint.setFlags(SkPaint::kAntiAlias_Flag); 62 paint.setFlags(SkPaint::kAntiAlias_Flag);
64 canvas->DrawCircle( 63 canvas->DrawCircle(
65 gfx::Point(size.width() / 2, 64 gfx::Point(size.width() / 2,
66 size.height() - kIndicatorOffsetFromBottom - kIndicatorRadius), 65 size.height() - kIndicatorOffsetFromBottom - kIndicatorRadius),
67 kIndicatorRadius, paint); 66 kIndicatorRadius, paint);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 ShelfButton::ShelfButton(InkDropButtonListener* listener, ShelfView* shelf_view) 252 ShelfButton::ShelfButton(InkDropButtonListener* listener, ShelfView* shelf_view)
254 : CustomButton(nullptr), 253 : CustomButton(nullptr),
255 listener_(listener), 254 listener_(listener),
256 shelf_view_(shelf_view), 255 shelf_view_(shelf_view),
257 icon_view_(new views::ImageView()), 256 icon_view_(new views::ImageView()),
258 bar_(new BarView(shelf_view->shelf())), 257 bar_(new BarView(shelf_view->shelf())),
259 state_(STATE_NORMAL), 258 state_(STATE_NORMAL),
260 destroyed_flag_(nullptr) { 259 destroyed_flag_(nullptr) {
261 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); 260 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
262 if (ash::MaterialDesignController::IsShelfMaterial()) { 261 if (ash::MaterialDesignController::IsShelfMaterial()) {
263 SetHasInkDrop(true); 262 SetHasInkDrop(INK_DROP_WITH_GESTURE_HANDLING);
264 set_ink_drop_base_color(kInkDropBaseColor); 263 set_ink_drop_base_color(kShelfInkDropBaseColor);
265 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); 264 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity);
266 } 265 }
267 266
268 const gfx::ShadowValue kShadows[] = { 267 const gfx::ShadowValue kShadows[] = {
269 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)), 268 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)),
270 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)), 269 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)),
271 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), 270 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)),
272 }; 271 };
273 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows)); 272 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows));
274 273
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 views::ImageView::TRAILING)); 573 views::ImageView::TRAILING));
575 bar_->SetVerticalAlignment(shelf->SelectValueForShelfAlignment( 574 bar_->SetVerticalAlignment(shelf->SelectValueForShelfAlignment(
576 views::ImageView::TRAILING, views::ImageView::CENTER, 575 views::ImageView::TRAILING, views::ImageView::CENTER,
577 views::ImageView::CENTER)); 576 views::ImageView::CENTER));
578 bar_->SchedulePaint(); 577 bar_->SchedulePaint();
579 } 578 }
580 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); 579 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL);
581 } 580 }
582 581
583 } // namespace ash 582 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698