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/autoclick_controller.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 // AutoclickRingHandler displays an animated affordance that is shown | |
21 // on autoclick gesture. The animation sequence consists of two circles which | |
22 // shrink towards the spot the autoclick will generate a mouse event. | |
23 class AutoclickRingHandler : public gfx::LinearAnimation, | |
24 public aura::WindowObserver, | |
25 public ash::AutoclickController::Delegate { | |
26 public: | |
27 AutoclickRingHandler(); | |
28 ~AutoclickRingHandler() override; | |
29 | |
30 private: | |
31 // Overriden from ash::AutoclickController::Delegate. | |
32 void StartGesture(base::TimeDelta duration, gfx::Point center) override; | |
33 void StopGesture() override; | |
34 void SetGestureCenter(gfx::Point center) override; | |
35 | |
36 class AutoclickRingView; | |
37 | |
38 enum AnimationType { | |
oshima
2016/06/13 21:57:30
optional: enum class
sammiequon
2016/06/15 15:40:53
Done.
| |
39 NONE, | |
40 GROW_ANIMATION, | |
41 SHRINK_ANIMATION, | |
42 }; | |
43 | |
44 aura::Window* GetTargetWindow(); | |
45 void SetTapDownTarget(); | |
46 void StartAnimation(base::TimeDelta duration); | |
47 void StopAutoclickRing(); | |
48 void SetTapDownTarget(aura::Window* target); | |
49 | |
50 // Overridden from gfx::LinearAnimation. | |
51 void AnimateToState(double state) override; | |
52 void AnimationStopped() override; | |
53 | |
54 // Overridden from aura::WindowObserver. | |
55 void OnWindowDestroying(aura::Window* window) override; | |
56 | |
57 std::unique_ptr<AutoclickRingView> view_; | |
58 gfx::Point tap_down_location_; | |
oshima
2016/06/13 21:57:30
please document the coordinates.
sammiequon
2016/06/15 15:40:53
Done.
| |
59 aura::Window* tap_down_target_; | |
oshima
2016/06/13 21:57:30
please document ownership (or lifetime)
sammiequon
2016/06/15 15:40:53
Done.
| |
60 AnimationType current_animation_type_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(AutoclickRingHandler); | |
63 }; | |
64 | |
65 } // namespace chromeos | |
66 | |
67 #endif // CHROME_BROWSER_CHROMEOS_UI_AUTOCLICK_RING_HANDLER_H_ | |
OLD | NEW |