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

Side by Side Diff: ash/autoclick/common/autoclick_controller_common.h

Issue 2316553003: mash: Add autoclick app. (Closed)
Patch Set: MouseEvent; if etc. Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_COMMON_AUTOCLICK_CONTROLLER_COMMON_H 5 #ifndef ASH_AUTOCLICK_COMMON_AUTOCLICK_CONTROLLER_COMMON_H
6 #define ASH_AUTOCLICK_COMMON_AUTOCLICK_CONTROLLER_COMMON_H 6 #define ASH_AUTOCLICK_COMMON_AUTOCLICK_CONTROLLER_COMMON_H
7 7
8 #include "ash/autoclick/common/autoclick_ring_handler.h" 8 #include "ash/autoclick/common/autoclick_ring_handler.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 11 matching lines...) Expand all
22 class ScrollEvent; 22 class ScrollEvent;
23 } 23 }
24 24
25 namespace ash { 25 namespace ash {
26 class AutoclickControllerCommonDelegate; 26 class AutoclickControllerCommonDelegate;
27 27
28 // Autoclick is one of the accessibility features. If enabled, two circles will 28 // Autoclick is one of the accessibility features. If enabled, two circles will
29 // animate at the mouse event location and an automatic click event will happen 29 // animate at the mouse event location and an automatic click event will happen
30 // after a certain amout of time at that location. 30 // after a certain amout of time at that location.
31 // AutoclickControllerCommon is the common code for both ash and mus to handle 31 // AutoclickControllerCommon is the common code for both ash and mus to handle
32 // events and to manage autoclick time delay, timer and ring widget. 32 // events and to manage autoclick time delay and timer.
33 class AutoclickControllerCommon { 33 class AutoclickControllerCommon {
34 public: 34 public:
35 AutoclickControllerCommon(base::TimeDelta delay, 35 AutoclickControllerCommon(base::TimeDelta delay,
36 AutoclickControllerCommonDelegate* delegate); 36 AutoclickControllerCommonDelegate* delegate);
37 ~AutoclickControllerCommon(); 37 ~AutoclickControllerCommon();
38 38
39 void HandleMouseEvent(const ui::MouseEvent& event); 39 void HandleMouseEvent(const ui::MouseEvent& event);
40 void HandleKeyEvent(const ui::KeyEvent& event); 40 void HandleKeyEvent(const ui::KeyEvent& event);
41 41
42 void SetAutoclickDelay(const base::TimeDelta delay); 42 void SetAutoclickDelay(const base::TimeDelta delay);
43 void CancelAutoclick(); 43 void CancelAutoclick();
44 44
45 private: 45 private:
46 void InitClickTimer(); 46 void InitClickTimer();
47 47
48 void DoAutoclick(); 48 void DoAutoclick();
49 49
50 void UpdateRingWidget(const gfx::Point& mouse_location); 50 void UpdateRingWidget(const gfx::Point& mouse_location);
51 51
52 base::TimeDelta delay_; 52 base::TimeDelta delay_;
53 int mouse_event_flags_; 53 int mouse_event_flags_;
54 std::unique_ptr<base::Timer> autoclick_timer_; 54 std::unique_ptr<base::Timer> autoclick_timer_;
55 AutoclickControllerCommonDelegate* delegate_; 55 AutoclickControllerCommonDelegate* delegate_;
56 std::unique_ptr<views::Widget> widget_; 56 views::Widget* widget_;
57 // The position in screen coordinates used to determine 57 // The position in screen coordinates used to determine
58 // the distance the mouse has moved. 58 // the distance the mouse has moved.
59 gfx::Point anchor_location_; 59 gfx::Point anchor_location_;
60 std::unique_ptr<AutoclickRingHandler> autoclick_ring_handler_; 60 std::unique_ptr<AutoclickRingHandler> autoclick_ring_handler_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(AutoclickControllerCommon); 62 DISALLOW_COPY_AND_ASSIGN(AutoclickControllerCommon);
63 }; 63 };
64 64
65 } // namespace ash 65 } // namespace ash
66 66
67 #endif // ASH_AUTOCLICK_COMMON_AUTOCLICK_CONTROLLER_COMMON_H 67 #endif // ASH_AUTOCLICK_COMMON_AUTOCLICK_CONTROLLER_COMMON_H
OLDNEW
« no previous file with comments | « ash/autoclick/autoclick_controller.cc ('k') | ash/autoclick/common/autoclick_controller_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698