Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef ASH_AUTOCLICK_AUTOCLICK_CONTROLLER_H | 5 #ifndef ASH_AUTOCLICK_AUTOCLICK_CONTROLLER_H |
| 6 #define ASH_AUTOCLICK_AUTOCLICK_CONTROLLER_H | 6 #define ASH_AUTOCLICK_AUTOCLICK_CONTROLLER_H |
| 7 | 7 |
| 8 #include <memory> | |
| 9 | |
| 8 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "base/macros.h" | |
| 12 #include "base/time/time.h" | |
| 13 #include "ui/gfx/geometry/point.h" | |
| 9 | 14 |
| 10 namespace ash { | 15 namespace ash { |
| 11 | 16 |
| 12 // Controls the autoclick a11y feature in ash. | 17 // Controls the autoclick a11y feature in ash. |
| 13 // If enabled, we will automatically send a click event a short time after | 18 // If enabled, we will automatically send a click event a short time after |
| 14 // the mouse had been at rest. | 19 // the mouse had been at rest. |
| 15 class ASH_EXPORT AutoclickController { | 20 class ASH_EXPORT AutoclickController { |
| 16 public: | 21 public: |
| 22 class Delegate { | |
| 23 public: | |
| 24 Delegate() {} | |
| 25 virtual ~Delegate() {} | |
| 26 | |
| 27 // Called when an autoclick gesture begins. | |
| 28 virtual void StartGesture(base::TimeDelta duration, gfx::Point center) = 0; | |
| 29 | |
| 30 // Called when the gesture has ended, | |
|
jdufault
2016/06/09 16:41:26
Cleanup the text wrapping so the first line is as
sammiequon
2016/06/10 19:30:26
Done.
| |
| 31 // either because the mouse moved or because the autoclick completed. | |
| 32 virtual void StopGesture() = 0; | |
| 33 | |
| 34 // Called when the autoclick target has changed. | |
| 35 virtual void SetGestureCenter(gfx::Point center) = 0; | |
| 36 | |
| 37 private: | |
| 38 DISALLOW_COPY_AND_ASSIGN(Delegate); | |
| 39 }; | |
| 40 | |
| 17 virtual ~AutoclickController() {} | 41 virtual ~AutoclickController() {} |
| 18 | 42 |
| 43 // Set the delegate to work with. | |
| 44 virtual void SetDelegate(std::unique_ptr<Delegate> delegate) = 0; | |
| 45 | |
| 19 // Set whether autoclicking is enabled. | 46 // Set whether autoclicking is enabled. |
| 20 virtual void SetEnabled(bool enabled) = 0; | 47 virtual void SetEnabled(bool enabled) = 0; |
| 21 | 48 |
| 22 // Returns true if autoclicking is enabled. | 49 // Returns true if autoclicking is enabled. |
| 23 virtual bool IsEnabled() const = 0; | 50 virtual bool IsEnabled() const = 0; |
| 24 | 51 |
| 25 // Set the time to wait in milliseconds from when the mouse stops moving | 52 // Set the time to wait in milliseconds from when the mouse stops moving |
| 26 // to when the autoclick event is sent. | 53 // to when the autoclick event is sent. |
| 27 virtual void SetAutoclickDelay(int delay_ms) = 0; | 54 virtual void SetAutoclickDelay(base::TimeDelta delay) = 0; |
| 28 | 55 |
| 29 // Returns the autoclick delay in milliseconds. | 56 // Returns the autoclick delay in milliseconds. |
| 30 virtual int GetAutoclickDelay() const = 0; | 57 virtual base::TimeDelta GetAutoclickDelay() const = 0; |
| 31 | 58 |
| 32 static AutoclickController* CreateInstance(); | 59 static AutoclickController* CreateInstance(); |
| 33 | 60 |
| 34 // The default wait time between last mouse movement and sending | 61 // The default wait time between last mouse movement and sending |
| 35 // the autoclick. | 62 // the autoclick. |
| 36 static const int kDefaultAutoclickDelayMs; | 63 static const int kDefaultAutoclickDelayMs; |
| 37 | 64 |
| 38 protected: | 65 protected: |
| 39 AutoclickController() {} | 66 AutoclickController() {} |
| 40 }; | 67 }; |
| 41 | 68 |
| 42 } // namespace ash | 69 } // namespace ash |
| 43 | 70 |
| 44 #endif // ASH_AUTOCLICK_AUTOCLICK_CONTROLLER_H | 71 #endif // ASH_AUTOCLICK_AUTOCLICK_CONTROLLER_H |
| OLD | NEW |