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

Side by Side Diff: ui/views/animation/ink_drop_host_view.cc

Issue 1724963002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky review Created 4 years, 10 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 | « ui/views/animation/ink_drop_host_view.h ('k') | ui/views/animation/ink_drop_hover.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/views/animation/ink_drop_host_view.h" 5 #include "ui/views/animation/ink_drop_host_view.h"
6 6
7 #include "ui/gfx/color_palette.h"
7 #include "ui/views/animation/ink_drop_hover.h" 8 #include "ui/views/animation/ink_drop_hover.h"
8 #include "ui/views/animation/square_ink_drop_animation.h" 9 #include "ui/views/animation/square_ink_drop_animation.h"
9 10
10 namespace views { 11 namespace views {
11 12
12 // Default sizes for ink drop effects. 13 // Default sizes for ink drop effects.
13 const int kInkDropLargeSize = 32; 14 const int kInkDropLargeSize = 32;
14 const int kInkDropLargeCornerRadius = 4; 15 const int kInkDropLargeCornerRadius = 4;
15 const int kInkDropSmallSize = 24; 16 const int kInkDropSmallSize = 24;
16 const int kInkDropSmallCornerRadius = 2; 17 const int kInkDropSmallCornerRadius = 2;
17 18
18 InkDropHostView::InkDropHostView() {} 19 InkDropHostView::InkDropHostView() {}
19 20
20 InkDropHostView::~InkDropHostView() {} 21 InkDropHostView::~InkDropHostView() {}
21 22
22 void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) { 23 void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) {
23 SetPaintToLayer(true); 24 SetPaintToLayer(true);
24 SetFillsBoundsOpaquely(false); 25 SetFillsBoundsOpaquely(false);
25 layer()->Add(ink_drop_layer); 26 layer()->Add(ink_drop_layer);
26 layer()->StackAtBottom(ink_drop_layer); 27 layer()->StackAtBottom(ink_drop_layer);
27 } 28 }
28 29
29 void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { 30 void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
30 layer()->Remove(ink_drop_layer); 31 layer()->Remove(ink_drop_layer);
31 SetFillsBoundsOpaquely(true);
32 SetPaintToLayer(false); 32 SetPaintToLayer(false);
33 } 33 }
34 34
35 scoped_ptr<InkDropAnimation> InkDropHostView::CreateInkDropAnimation() const { 35 scoped_ptr<InkDropAnimation> InkDropHostView::CreateInkDropAnimation() const {
36 scoped_ptr<InkDropAnimation> animation(new SquareInkDropAnimation( 36 scoped_ptr<InkDropAnimation> animation(new SquareInkDropAnimation(
37 gfx::Size(kInkDropLargeSize, kInkDropLargeSize), 37 gfx::Size(kInkDropLargeSize, kInkDropLargeSize),
38 kInkDropLargeCornerRadius, 38 kInkDropLargeCornerRadius,
39 gfx::Size(kInkDropSmallSize, kInkDropSmallSize), 39 gfx::Size(kInkDropSmallSize, kInkDropSmallSize),
40 kInkDropSmallCornerRadius)); 40 kInkDropSmallCornerRadius, GetInkDropCenter(), GetInkDropBaseColor()));
41 animation->SetCenterPoint(GetInkDropCenter());
42 return animation; 41 return animation;
43 } 42 }
44 43
45 scoped_ptr<InkDropHover> InkDropHostView::CreateInkDropHover() const { 44 scoped_ptr<InkDropHover> InkDropHostView::CreateInkDropHover() const {
46 scoped_ptr<InkDropHover> hover( 45 scoped_ptr<InkDropHover> hover(new InkDropHover(
47 new InkDropHover(gfx::Size(kInkDropSmallSize, kInkDropSmallSize), 46 gfx::Size(kInkDropSmallSize, kInkDropSmallSize),
48 kInkDropSmallCornerRadius)); 47 kInkDropSmallCornerRadius, GetInkDropCenter(), GetInkDropBaseColor()));
49 hover->SetCenterPoint(GetInkDropCenter());
50 return hover; 48 return hover;
51 } 49 }
52 50
53 gfx::Point InkDropHostView::GetInkDropCenter() const { 51 gfx::Point InkDropHostView::GetInkDropCenter() const {
54 return GetLocalBounds().CenterPoint(); 52 return GetLocalBounds().CenterPoint();
55 } 53 }
56 54
55 SkColor InkDropHostView::GetInkDropBaseColor() const {
56 NOTREACHED();
57 return gfx::kPlaceholderColor;
58 }
59
57 } // namespace views 60 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_host_view.h ('k') | ui/views/animation/ink_drop_hover.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698