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

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: Rebased 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
« no previous file with comments | « ash/shelf/shelf.cc ('k') | ash/shelf/shelf_tooltip_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const SkColor kIndicatorColor = SK_ColorWHITE; 48 const SkColor kIndicatorColor = SK_ColorWHITE;
49 49
50 // Canvas scale to ensure that the activity indicator is not pixelated even at 50 // Canvas scale to ensure that the activity indicator is not pixelated even at
51 // the highest possible device scale factors. 51 // the highest possible device scale factors.
52 const int kIndicatorCanvasScale = 5; 52 const int kIndicatorCanvasScale = 5;
53 53
54 // Shelf item ripple constants. 54 // Shelf item ripple constants.
55 const int kInkDropSmallSize = 48; 55 const int kInkDropSmallSize = 48;
56 const int kInkDropLargeSize = 60; 56 const int kInkDropLargeSize = 60;
57 const int kInkDropLargeCornerRadius = 4; 57 const int kInkDropLargeCornerRadius = 4;
58 const SkColor kInkDropBaseColor = SK_ColorWHITE;
59 58
60 // Paints an activity indicator on |canvas| whose |size| is specified in DIP. 59 // Paints an activity indicator on |canvas| whose |size| is specified in DIP.
61 void PaintIndicatorOnCanvas(gfx::Canvas* canvas, const gfx::Size& size) { 60 void PaintIndicatorOnCanvas(gfx::Canvas* canvas, const gfx::Size& size) {
62 SkPaint paint; 61 SkPaint paint;
63 paint.setColor(kIndicatorColor); 62 paint.setColor(kIndicatorColor);
64 paint.setFlags(SkPaint::kAntiAlias_Flag); 63 paint.setFlags(SkPaint::kAntiAlias_Flag);
65 canvas->DrawCircle( 64 canvas->DrawCircle(
66 gfx::Point(size.width() / 2, 65 gfx::Point(size.width() / 2,
67 size.height() - kIndicatorOffsetFromBottom - kIndicatorRadius), 66 size.height() - kIndicatorOffsetFromBottom - kIndicatorRadius),
68 kIndicatorRadius, paint); 67 kIndicatorRadius, paint);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 ShelfButton::ShelfButton(InkDropButtonListener* listener, ShelfView* shelf_view) 248 ShelfButton::ShelfButton(InkDropButtonListener* listener, ShelfView* shelf_view)
250 : CustomButton(nullptr), 249 : CustomButton(nullptr),
251 listener_(listener), 250 listener_(listener),
252 shelf_view_(shelf_view), 251 shelf_view_(shelf_view),
253 icon_view_(new views::ImageView()), 252 icon_view_(new views::ImageView()),
254 bar_(new BarView(shelf_view->shelf())), 253 bar_(new BarView(shelf_view->shelf())),
255 state_(STATE_NORMAL), 254 state_(STATE_NORMAL),
256 destroyed_flag_(nullptr) { 255 destroyed_flag_(nullptr) {
257 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); 256 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
258 if (ash::MaterialDesignController::IsShelfMaterial()) { 257 if (ash::MaterialDesignController::IsShelfMaterial()) {
259 SetHasInkDrop(true); 258 SetInkDropMode(InkDropMode::ON);
260 set_ink_drop_base_color(kInkDropBaseColor); 259 set_ink_drop_base_color(kShelfInkDropBaseColor);
261 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); 260 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity);
262 } 261 }
263 262
264 const gfx::ShadowValue kShadows[] = { 263 const gfx::ShadowValue kShadows[] = {
265 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)), 264 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)),
266 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)), 265 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)),
267 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), 266 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)),
268 }; 267 };
269 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows)); 268 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows));
270 269
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 views::ImageView::TRAILING)); 571 views::ImageView::TRAILING));
573 bar_->SetVerticalAlignment(shelf->SelectValueForShelfAlignment( 572 bar_->SetVerticalAlignment(shelf->SelectValueForShelfAlignment(
574 views::ImageView::TRAILING, views::ImageView::CENTER, 573 views::ImageView::TRAILING, views::ImageView::CENTER,
575 views::ImageView::CENTER)); 574 views::ImageView::CENTER));
576 bar_->SchedulePaint(); 575 bar_->SchedulePaint();
577 } 576 }
578 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); 577 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL);
579 } 578 }
580 579
581 } // namespace ash 580 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf.cc ('k') | ash/shelf/shelf_tooltip_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698