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

Side by Side Diff: ash/laser/laser_pointer_controller.h

Issue 2361563002: chromeos: Laser tool blocks events from propagating. (Closed)
Patch Set: 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
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/laser/laser_pointer_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
(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_LASER_LASER_POINTER_CONTROLLER_H_
6 #define ASH_LASER_LASER_POINTER_CONTROLLER_H_
7
8 #include <memory>
9
10 #include "ash/ash_export.h"
11 #include "base/macros.h"
12 #include "ui/aura/window_observer.h"
13 #include "ui/events/event_handler.h"
14 #include "ui/gfx/geometry/point.h"
15
16 namespace base {
17 class Timer;
18 }
19
20 namespace ui {
21 class MouseEvent;
22 }
23
24 namespace ash {
25
26 class LaserPointerView;
27
28 // Controller for the laser pointer functionality. Enables/disables laser
29 // pointer as well as receives points and passes them off to be rendered.
30 class ASH_EXPORT LaserPointerController : public ui::EventHandler,
31 public aura::WindowObserver {
32 public:
33 LaserPointerController();
34 ~LaserPointerController() override;
35
36 // Turns the laser pointer feature on or off. The user still has to press and
37 // drag to see the laser pointer.
38 void SetEnabled(bool enabled);
39
40 private:
41 friend class LaserPointerControllerTestApi;
42
43 // ui::EventHandler:
44 void OnMouseEvent(ui::MouseEvent* event) override;
45
46 // aura::WindowObserver:
47 void OnWindowDestroying(aura::Window* window) override;
48
49 // Reparent, recreate or destroy LaserPointerView instance as needed based on
50 // the current window and the widgets window.
51 void SwitchTargetRootWindowIfNeeded(aura::Window* root_window);
52
53 // Timer callback which adds a point where the mouse was last seen. This
54 // allows the trail to fade away when the mouse is stationary.
55 void AddStationaryPoint();
56
57 // Timer which will add a new stationary point when the mouse stops moving.
58 // This will remove points that are too old.
59 std::unique_ptr<base::Timer> stationary_timer_;
60 int stationary_timer_repeat_count_ = 0;
61
62 bool enabled_ = false;
63
64 // The last seen mouse location in screen coordinates.
65 gfx::Point current_mouse_location_;
66
67 // |laser_pointer_view_| will only hold an instance when the laser pointer is
68 // enabled and activated (pressed or dragged).
69 std::unique_ptr<LaserPointerView> laser_pointer_view_;
70
71 DISALLOW_COPY_AND_ASSIGN(LaserPointerController);
72 };
73
74 } // namespace ash
75
76 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/laser/laser_pointer_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698