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

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

Issue 2041033002: Moved ButtonInkDropDelegate logic into InkDropHostView and deleted InkDropDelegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed merge conflict in custom_button.cc 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_impl.h ('k') | ui/views/animation/ink_drop_stub.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_impl.h" 5 #include "ui/views/animation/ink_drop_impl.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/timer/timer.h" 8 #include "base/timer/timer.h"
9 #include "ui/compositor/layer.h" 9 #include "ui/compositor/layer.h"
10 #include "ui/views/animation/ink_drop_highlight.h" 10 #include "ui/views/animation/ink_drop_highlight.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 DestroyInkDropRipple(); 66 DestroyInkDropRipple();
67 DestroyInkDropHighlight(); 67 DestroyInkDropHighlight();
68 } 68 }
69 69
70 InkDropState InkDropImpl::GetTargetInkDropState() const { 70 InkDropState InkDropImpl::GetTargetInkDropState() const {
71 if (!ink_drop_ripple_) 71 if (!ink_drop_ripple_)
72 return InkDropState::HIDDEN; 72 return InkDropState::HIDDEN;
73 return ink_drop_ripple_->target_ink_drop_state(); 73 return ink_drop_ripple_->target_ink_drop_state();
74 } 74 }
75 75
76 bool InkDropImpl::IsVisible() const {
77 return ink_drop_ripple_ && ink_drop_ripple_->IsVisible();
78 }
79
80 void InkDropImpl::AnimateToState(InkDropState ink_drop_state) { 76 void InkDropImpl::AnimateToState(InkDropState ink_drop_state) {
81 DestroyHiddenTargetedAnimations(); 77 DestroyHiddenTargetedAnimations();
82 if (!ink_drop_ripple_) 78 if (!ink_drop_ripple_)
83 CreateInkDropRipple(); 79 CreateInkDropRipple();
84 80
85 if (ink_drop_state != views::InkDropState::HIDDEN) { 81 if (ink_drop_state != views::InkDropState::HIDDEN) {
86 SetHighlight(false, base::TimeDelta::FromMilliseconds( 82 SetHighlight(false, base::TimeDelta::FromMilliseconds(
87 kHighlightFadeOutBeforeRippleDurationInMs), 83 kHighlightFadeOutBeforeRippleDurationInMs),
88 true); 84 true);
89 } 85 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void InkDropImpl::SetHighlight(bool should_highlight, 214 void InkDropImpl::SetHighlight(bool should_highlight,
219 base::TimeDelta animation_duration, 215 base::TimeDelta animation_duration,
220 bool explode) { 216 bool explode) {
221 StopHighlightAfterRippleTimer(); 217 StopHighlightAfterRippleTimer();
222 218
223 if (IsHighlightFadingInOrVisible() == should_highlight) 219 if (IsHighlightFadingInOrVisible() == should_highlight)
224 return; 220 return;
225 221
226 if (should_highlight) { 222 if (should_highlight) {
227 CreateInkDropHighlight(); 223 CreateInkDropHighlight();
228 if (highlight_ && !IsVisible()) 224 if (highlight_ && !(ink_drop_ripple_ && ink_drop_ripple_->IsVisible()))
229 highlight_->FadeIn(animation_duration); 225 highlight_->FadeIn(animation_duration);
230 } else { 226 } else {
231 highlight_->FadeOut(animation_duration, explode); 227 highlight_->FadeOut(animation_duration, explode);
232 } 228 }
233 } 229 }
234 230
235 bool InkDropImpl::ShouldHighlight() const { 231 bool InkDropImpl::ShouldHighlight() const {
236 return is_focused_ || is_hovered_; 232 return is_focused_ || is_hovered_;
237 } 233 }
238 234
(...skipping 16 matching lines...) Expand all
255 } 251 }
256 252
257 void InkDropImpl::HighlightAfterRippleTimerFired() { 253 void InkDropImpl::HighlightAfterRippleTimerFired() {
258 SetHighlight(true, base::TimeDelta::FromMilliseconds( 254 SetHighlight(true, base::TimeDelta::FromMilliseconds(
259 kHighlightFadeInAfterRippleDurationInMs), 255 kHighlightFadeInAfterRippleDurationInMs),
260 true); 256 true);
261 highlight_after_ripple_timer_.reset(); 257 highlight_after_ripple_timer_.reset();
262 } 258 }
263 259
264 } // namespace views 260 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_impl.h ('k') | ui/views/animation/ink_drop_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698