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

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

Issue 2034963002: Rename InkDropHover to InkDropHighlight (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gyp file 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
« 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/gfx/color_palette.h"
8 #include "ui/gfx/geometry/size_conversions.h" 8 #include "ui/gfx/geometry/size_conversions.h"
9 #include "ui/views/animation/ink_drop.h" 9 #include "ui/views/animation/ink_drop.h"
10 #include "ui/views/animation/ink_drop_hover.h" 10 #include "ui/views/animation/ink_drop_highlight.h"
11 #include "ui/views/animation/square_ink_drop_ripple.h" 11 #include "ui/views/animation/square_ink_drop_ripple.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 // Default sizes for ink drop effects. 15 // Default sizes for ink drop effects.
16 const int kInkDropSize = 24; 16 const int kInkDropSize = 24;
17 const int kInkDropLargeCornerRadius = 4; 17 const int kInkDropLargeCornerRadius = 4;
18 18
19 // The scale factor to compute the large ink drop size. 19 // The scale factor to compute the large ink drop size.
20 const float kLargeInkDropScale = 1.333f; 20 const float kLargeInkDropScale = 1.333f;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 std::unique_ptr<InkDropRipple> InkDropHostView::CreateInkDropRipple() const { 59 std::unique_ptr<InkDropRipple> InkDropHostView::CreateInkDropRipple() const {
60 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple( 60 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple(
61 CalculateLargeInkDropSize(ink_drop_size_), kInkDropLargeCornerRadius, 61 CalculateLargeInkDropSize(ink_drop_size_), kInkDropLargeCornerRadius,
62 ink_drop_size_, kInkDropSmallCornerRadius, GetInkDropCenter(), 62 ink_drop_size_, kInkDropSmallCornerRadius, GetInkDropCenter(),
63 GetInkDropBaseColor())); 63 GetInkDropBaseColor()));
64 return ripple; 64 return ripple;
65 } 65 }
66 66
67 std::unique_ptr<InkDropHover> InkDropHostView::CreateInkDropHover() const { 67 std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight()
68 std::unique_ptr<InkDropHover> hover( 68 const {
69 new InkDropHover(ink_drop_size_, kInkDropSmallCornerRadius, 69 std::unique_ptr<InkDropHighlight> highlight(
70 GetInkDropCenter(), GetInkDropBaseColor())); 70 new InkDropHighlight(ink_drop_size_, kInkDropSmallCornerRadius,
71 hover->set_explode_size(CalculateLargeInkDropSize(ink_drop_size_)); 71 GetInkDropCenter(), GetInkDropBaseColor()));
72 return hover; 72 highlight->set_explode_size(CalculateLargeInkDropSize(ink_drop_size_));
73 return highlight;
73 } 74 }
74 75
75 void InkDropHostView::OnFocus() { 76 void InkDropHostView::OnFocus() {
76 views::View::OnFocus(); 77 views::View::OnFocus();
77 if (ink_drop_delegate() && ShouldShowInkDropForFocus()) 78 if (ink_drop_delegate() && ShouldShowInkDropForFocus())
78 ink_drop_delegate()->GetInkDrop()->SetFocused(true); 79 ink_drop_delegate()->GetInkDrop()->SetFocused(true);
79 } 80 }
80 81
81 void InkDropHostView::OnBlur() { 82 void InkDropHostView::OnBlur() {
82 views::View::OnBlur(); 83 views::View::OnBlur();
83 if (ink_drop_delegate() && ShouldShowInkDropForFocus()) 84 if (ink_drop_delegate() && ShouldShowInkDropForFocus())
84 ink_drop_delegate()->GetInkDrop()->SetFocused(false); 85 ink_drop_delegate()->GetInkDrop()->SetFocused(false);
85 } 86 }
86 87
87 gfx::Point InkDropHostView::GetInkDropCenter() const { 88 gfx::Point InkDropHostView::GetInkDropCenter() const {
88 return GetLocalBounds().CenterPoint(); 89 return GetLocalBounds().CenterPoint();
89 } 90 }
90 91
91 SkColor InkDropHostView::GetInkDropBaseColor() const { 92 SkColor InkDropHostView::GetInkDropBaseColor() const {
92 NOTREACHED(); 93 NOTREACHED();
93 return gfx::kPlaceholderColor; 94 return gfx::kPlaceholderColor;
94 } 95 }
95 96
96 bool InkDropHostView::ShouldShowInkDropForFocus() const { 97 bool InkDropHostView::ShouldShowInkDropForFocus() const {
97 return false; 98 return false;
98 } 99 }
99 100
100 } // namespace views 101 } // 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