| 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, | |
| 33 const gfx::Point& center_point_in_screen) override; | |
| 34 void StopGesture() override; | |
| 35 void SetGestureCenter(const gfx::Point& center_point_in_screen) override; | |
| 36 | |
| 37 class AutoclickRingView; | |
| 38 | |
| 39 enum class AnimationType { | |
| 40 NONE, | |
| 41 GROW_ANIMATION, | |
| 42 SHRINK_ANIMATION, | |
| 43 }; | |
| 44 | |
| 45 aura::Window* GetTargetWindow(); | |
| 46 void SetTapDownTarget(); | |
| 47 void StartAnimation(base::TimeDelta duration); | |
| 48 void StopAutoclickRing(); | |
| 49 void SetTapDownTarget(aura::Window* target); | |
| 50 | |
| 51 // Overridden from gfx::LinearAnimation. | |
| 52 void AnimateToState(double state) override; | |
| 53 void AnimationStopped() override; | |
| 54 | |
| 55 // Overridden from aura::WindowObserver. | |
| 56 void OnWindowDestroying(aura::Window* window) override; | |
| 57 | |
| 58 std::unique_ptr<AutoclickRingView> view_; | |
| 59 // Location of the simulated mouse event from auto click in screen | |
| 60 // coordinates. | |
| 61 gfx::Point tap_down_location_; | |
| 62 // The target window is observed by AutoclickRingHandler for the duration of | |
| 63 // a autoclick gesture. | |
| 64 aura::Window* tap_down_target_; | |
| 65 AnimationType current_animation_type_; | |
| 66 base::TimeDelta animation_duration_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(AutoclickRingHandler); | |
| 69 }; | |
| 70 | |
| 71 } // namespace chromeos | |
| 72 | |
| 73 #endif // CHROME_BROWSER_CHROMEOS_UI_AUTOCLICK_RING_HANDLER_H_ | |
| OLD | NEW |