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

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, 6 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/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/common/ash_constants.h" 10 #include "ash/common/ash_constants.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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(true);
264 set_ink_drop_base_color(kInkDropBaseColor); 263 set_ink_drop_base_color(kShelfInkDropBaseColor);
265 } 264 }
266 265
267 const gfx::ShadowValue kShadows[] = { 266 const gfx::ShadowValue kShadows[] = {
268 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)), 267 gfx::ShadowValue(gfx::Vector2d(0, 2), 0, SkColorSetARGB(0x1A, 0, 0, 0)),
269 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)), 268 gfx::ShadowValue(gfx::Vector2d(0, 3), 1, SkColorSetARGB(0x1A, 0, 0, 0)),
270 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), 269 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)),
271 }; 270 };
272 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows)); 271 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows));
273 272
274 // TODO: refactor the layers so each button doesn't require 2. 273 // TODO: refactor the layers so each button doesn't require 2.
(...skipping 297 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

Powered by Google App Engine
This is Rietveld 408576698