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 // Overriden from ash::AutoclickController::Delegate. | |
jdufault
2016/06/08 17:50:19
Newline between dtor and comment.
sammiequon
2016/06/09 04:03:46
Done.
| |
30 void StartGesture(int duration_ms, gfx::Point center) override; | |
jdufault
2016/06/08 17:50:19
Make overrides private
sammiequon
2016/06/09 04:03:46
Done.
| |
31 void StopGesture() override; | |
32 void SetGestureCenter(gfx::Point center) override; | |
33 | |
34 private: | |
35 class AutoclickRingView; | |
36 | |
37 enum AnimationType { | |
38 NONE, | |
39 GROW_ANIMATION, | |
40 SHRINK_ANIMATION, | |
41 }; | |
42 | |
43 aura::Window* GetTargetWindow(); | |
44 void SetTapDownTarget(); | |
45 void StartAnimation(int duration_ms); | |
46 void StopAutoclickRing(); | |
47 void SetTapDownTarget(aura::Window* target); | |
48 | |
49 // Overridden from gfx::LinearAnimation. | |
50 void AnimateToState(double state) override; | |
51 void AnimationStopped() override; | |
52 | |
53 // Overridden from aura::WindowObserver. | |
54 void OnWindowDestroying(aura::Window* window) override; | |
55 | |
56 std::unique_ptr<AutoclickRingView> view_; | |
57 gfx::Point tap_down_location_; | |
58 aura::Window* tap_down_target_; | |
59 AnimationType current_animation_type_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(AutoclickRingHandler); | |
62 }; | |
63 | |
64 } // namespace chromeos | |
65 | |
66 #endif // CHROME_BROWSER_CHROMEOS_UI_AUTOCLICK_RING_HANDLER_H_ | |
OLD | NEW |