OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_UI_AUTOCLICK_RING_HANDLER_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_UI_AUTOCLICK_RING_HANDLER_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "ash/autoclick/autoclickgesture_delegate.h" | |
11 #include "base/macros.h" | |
12 #include "base/timer/timer.h" | |
13 #include "ui/aura/window_observer.h" | |
14 #include "ui/events/event.h" | |
15 #include "ui/gfx/animation/linear_animation.h" | |
16 #include "ui/gfx/geometry/point.h" | |
17 | |
18 namespace chromeos { | |
19 | |
20 // LongPressAutoclickRingHandler displays an animated affordance that is shown | |
21 // on a TAP_DOWN gesture. The animation sequence consists of two parts: | |
jdufault
2016/06/03 22:02:45
Remove the "TAP_DOWN" bit since this class doesn't
sammiequon
2016/06/07 18:06:16
Done.
| |
22 // The first part is a grow animation that starts at semi-long-press and | |
23 // completes on a long-press gesture. The affordance animates to full size | |
24 // during grow animation. | |
25 // The second part is a shrink animation that start after grow and shrinks the | |
26 // affordance out of view. | |
27 class LongPressAutoclickRingHandler : public gfx::LinearAnimation, | |
28 public aura::WindowObserver, | |
jdufault
2016/06/03 22:02:44
Remove the LongPress bit, since the class doesn't
sammiequon
2016/06/07 18:06:16
Done.
| |
29 public ash::AutoclickgestureDelegate { | |
30 public: | |
31 LongPressAutoclickRingHandler(); | |
32 ~LongPressAutoclickRingHandler() override; | |
33 | |
34 // Overriden from ash::AutoclickgestureDelegate. | |
35 void StartGesture(int delay_ms, gfx::Point center) override; | |
jdufault
2016/06/03 22:02:44
Should delay_ms be renamed to duration_ms?
Let's
sammiequon
2016/06/07 18:06:16
I couldn't find a base::TimeDuration type, but the
jdufault
2016/06/08 17:50:19
Sorry, I'm a bit confused now. How does gfx::Anima
| |
36 void StopGesture() override; | |
37 void SetGestureCenter(gfx::Point center) override; | |
38 | |
39 private: | |
40 class LongPressAutoclickRingView; | |
41 | |
42 enum LongPressAnimationType { | |
43 NONE, | |
44 GROW_ANIMATION, | |
45 SHRINK_ANIMATION, | |
46 }; | |
47 | |
48 aura::Window* GetTargetWindow(); | |
49 void SetTapDownTarget(); | |
50 void StartAnimation(int delay_ms); | |
51 void StopAutoclickRing(); | |
52 void SetTapDownTarget(aura::Window* target); | |
53 | |
54 // Overridden from gfx::LinearAnimation. | |
55 void AnimateToState(double state) override; | |
56 void AnimationStopped() override; | |
57 | |
58 // Overridden from aura::WindowObserver. | |
59 void OnWindowDestroying(aura::Window* window) override; | |
60 | |
61 std::unique_ptr<LongPressAutoclickRingView> view_; | |
62 gfx::Point tap_down_location_; | |
63 aura::Window* tap_down_target_; | |
64 LongPressAnimationType current_animation_type_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(LongPressAutoclickRingHandler); | |
67 }; | |
68 | |
69 } // namespace chromeos | |
70 | |
71 #endif // CHROME_BROWSER_CHROMEOS_UI_AUTOCLICK_RING_HANDLER_H_ | |
OLD | NEW |