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 "ui/gfx/geometry/point.h" | |
9 | 13 |
10 namespace ash { | 14 namespace ash { |
11 | 15 |
12 // Controls the autoclick a11y feature in ash. | 16 // Controls the autoclick a11y feature in ash. |
13 // If enabled, we will automatically send a click event a short time after | 17 // If enabled, we will automatically send a click event a short time after |
14 // the mouse had been at rest. | 18 // the mouse had been at rest. |
15 class ASH_EXPORT AutoclickController { | 19 class ASH_EXPORT AutoclickController { |
16 public: | 20 public: |
21 class Delegate { | |
22 public: | |
23 Delegate() {} | |
24 virtual ~Delegate() {} | |
25 | |
26 // Called when an autoclick gesture begins. | |
27 virtual void StartGesture(int duration_ms, gfx::Point center) = 0; | |
28 | |
29 // Called when the gesture has ended, | |
30 // either because the mouse moved or because the autoclick completed. | |
31 virtual void StopGesture() = 0; | |
32 | |
33 // Called when the autoclick target has changed. | |
34 virtual void SetGestureCenter(gfx::Point center) = 0; | |
35 | |
36 private: | |
37 DISALLOW_COPY_AND_ASSIGN(Delegate); | |
38 }; | |
39 | |
17 virtual ~AutoclickController() {} | 40 virtual ~AutoclickController() {} |
18 | 41 |
42 // Set the delegate to work with. | |
43 virtual void SetDelegate( | |
44 std::unique_ptr<Delegate> autoclickgesture_delegate) = 0; | |
jdufault
2016/06/08 17:50:19
Just |delegate|.
sammiequon
2016/06/09 04:03:46
Done.
| |
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 movin |
jdufault
2016/06/08 17:50:19
moving?
sammiequon
2016/06/09 04:03:46
Done.
| |
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(int delay_ms) = 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 int 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 |