Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(794)

Side by Side Diff: ash/autoclick/autoclick_controller.h

Issue 2016073004: Show a visual indicator for the progress of auto-click. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Rebase. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/autoclick/autoclick_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
29 const gfx::Point& center_point_in_screen) = 0;
30
31 // Called when the gesture has ended, either because the mouse moved or
32 // because the autoclick completed.
33 virtual void StopGesture() = 0;
34
35 // Called when the autoclick target has changed.
36 virtual void SetGestureCenter(const gfx::Point& center_point_in_screen) = 0;
37
38 private:
39 DISALLOW_COPY_AND_ASSIGN(Delegate);
40 };
41
17 virtual ~AutoclickController() {} 42 virtual ~AutoclickController() {}
18 43
44 // Set the delegate to work with.
45 virtual void SetDelegate(std::unique_ptr<Delegate> delegate) = 0;
46
19 // Set whether autoclicking is enabled. 47 // Set whether autoclicking is enabled.
20 virtual void SetEnabled(bool enabled) = 0; 48 virtual void SetEnabled(bool enabled) = 0;
21 49
22 // Returns true if autoclicking is enabled. 50 // Returns true if autoclicking is enabled.
23 virtual bool IsEnabled() const = 0; 51 virtual bool IsEnabled() const = 0;
24 52
25 // Set the time to wait in milliseconds from when the mouse stops moving 53 // Set the time to wait in milliseconds from when the mouse stops moving
26 // to when the autoclick event is sent. 54 // to when the autoclick event is sent.
27 virtual void SetAutoclickDelay(int delay_ms) = 0; 55 virtual void SetAutoclickDelay(base::TimeDelta delay) = 0;
28 56
29 // Returns the autoclick delay in milliseconds. 57 // Returns the autoclick delay in milliseconds.
30 virtual int GetAutoclickDelay() const = 0; 58 virtual base::TimeDelta GetAutoclickDelay() const = 0;
31 59
32 static AutoclickController* CreateInstance(); 60 static AutoclickController* CreateInstance();
33 61
34 // The default wait time between last mouse movement and sending 62 // The default wait time between last mouse movement and sending
35 // the autoclick. 63 // the autoclick.
36 static const int kDefaultAutoclickDelayMs; 64 static const int kDefaultAutoclickDelayMs;
37 65
66 // Gets the default wait time as a base::TimeDelta object.
67 static base::TimeDelta GetDefaultAutoclickDelay();
68
38 protected: 69 protected:
39 AutoclickController() {} 70 AutoclickController() {}
40 }; 71 };
41 72
42 } // namespace ash 73 } // namespace ash
43 74
44 #endif // ASH_AUTOCLICK_AUTOCLICK_CONTROLLER_H 75 #endif // ASH_AUTOCLICK_AUTOCLICK_CONTROLLER_H
OLDNEW
« no previous file with comments | « no previous file | ash/autoclick/autoclick_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698