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

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

Issue 2193563002: ash: Refactor autoclick common code to ash/autoclick/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: deps Created 4 years, 4 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 | « ash/autoclick/common/DEPS ('k') | ash/autoclick/common/autoclick_controller_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_AUTOCLICK_COMMON_AUTOCLICK_CONTROLLER_COMMON_H
6 #define ASH_AUTOCLICK_COMMON_AUTOCLICK_CONTROLLER_COMMON_H
7
8 #include "ash/autoclick/common/autoclick_ring_handler.h"
9 #include "base/macros.h"
10 #include "base/timer/timer.h"
11 #include "ui/gfx/geometry/point.h"
12
13 namespace views {
14 class Widget;
15 }
16
17 namespace ui {
18 class MouseEvent;
19 class KeyEvent;
20 class TouchEvent;
21 class GestureEvent;
22 class ScrollEvent;
23 }
24
25 namespace ash {
26 class AutoclickControllerCommonDelegate;
27
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
30 // after a certain amout of time at that location.
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.
33 class AutoclickControllerCommon {
34 public:
35 AutoclickControllerCommon(base::TimeDelta delay,
36 AutoclickControllerCommonDelegate* delegate);
37 ~AutoclickControllerCommon();
38
39 void HandleMouseEvent(const ui::MouseEvent& event);
40 void HandleKeyEvent(const ui::KeyEvent& event);
41
42 void SetAutoclickDelay(const base::TimeDelta delay);
43 void CancelAutoclick();
44
45 private:
46 void InitClickTimer();
47
48 void DoAutoclick();
49
50 void UpdateRingWidget(const gfx::Point& mouse_location);
51
52 base::TimeDelta delay_;
53 int mouse_event_flags_;
54 std::unique_ptr<base::Timer> autoclick_timer_;
55 AutoclickControllerCommonDelegate* delegate_;
56 std::unique_ptr<views::Widget> widget_;
57 // The position in screen coordinates used to determine
58 // the distance the mouse has moved.
59 gfx::Point anchor_location_;
60 std::unique_ptr<AutoclickRingHandler> autoclick_ring_handler_;
61
62 DISALLOW_COPY_AND_ASSIGN(AutoclickControllerCommon);
63 };
64
65 } // namespace ash
66
67 #endif // ASH_AUTOCLICK_COMMON_AUTOCLICK_CONTROLLER_COMMON_H
OLDNEW
« no previous file with comments | « ash/autoclick/common/DEPS ('k') | ash/autoclick/common/autoclick_controller_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698