OLD | NEW |
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_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/common/system/chromeos/palette/common_palette_tool.h" | 9 #include "ash/common/system/chromeos/palette/common_palette_tool.h" |
| 10 #include "ui/gfx/geometry/point.h" |
10 #include "ui/views/pointer_watcher.h" | 11 #include "ui/views/pointer_watcher.h" |
11 | 12 |
| 13 namespace base { |
| 14 class Timer; |
| 15 } |
| 16 |
12 namespace ash { | 17 namespace ash { |
13 | 18 |
14 class LaserPointerView; | 19 class LaserPointerView; |
15 | 20 |
16 // Controller for the laser pointer functionality. Enables/disables laser | 21 // Controller for the laser pointer functionality. Enables/disables laser |
17 // pointer as well as receives points and passes them off to be rendered. | 22 // pointer as well as receives points and passes them off to be rendered. |
18 class ASH_EXPORT LaserPointerMode : public CommonPaletteTool, | 23 class ASH_EXPORT LaserPointerMode : public CommonPaletteTool, |
19 public views::PointerWatcher { | 24 public views::PointerWatcher { |
20 public: | 25 public: |
21 explicit LaserPointerMode(Delegate* delegate); | 26 explicit LaserPointerMode(Delegate* delegate); |
22 ~LaserPointerMode() override; | 27 ~LaserPointerMode() override; |
23 | 28 |
24 private: | 29 private: |
25 friend class LaserPointerModeTestApi; | 30 friend class LaserPointerModeTestApi; |
26 | 31 |
27 // PaletteTool: | 32 // PaletteTool: |
28 PaletteGroup GetGroup() const override; | 33 PaletteGroup GetGroup() const override; |
29 PaletteToolId GetToolId() const override; | 34 PaletteToolId GetToolId() const override; |
30 void OnEnable() override; | 35 void OnEnable() override; |
31 void OnDisable() override; | 36 void OnDisable() override; |
32 gfx::VectorIconId GetActiveTrayIcon() override; | 37 const gfx::VectorIcon& GetActiveTrayIcon() const override; |
33 views::View* CreateView() override; | 38 views::View* CreateView() override; |
34 | 39 |
35 // CommonPaletteTool: | 40 // CommonPaletteTool: |
36 gfx::VectorIconId GetPaletteIconId() override; | 41 const gfx::VectorIcon& GetPaletteIcon() const override; |
37 | 42 |
38 // views::PointerWatcher: | 43 // views::PointerWatcher: |
39 void OnPointerEventObserved(const ui::PointerEvent& event, | 44 void OnPointerEventObserved(const ui::PointerEvent& event, |
40 const gfx::Point& location_in_screen, | 45 const gfx::Point& location_in_screen, |
41 views::Widget* target) override; | 46 views::Widget* target) override; |
42 | 47 |
43 void StopTimer(); | 48 void StopTimer(); |
44 | 49 |
45 // Timer callback which adds a point where the mouse was last seen. This | 50 // Timer callback which adds a point where the mouse was last seen. This |
46 // allows the trail to fade away when the mouse is stationary. | 51 // allows the trail to fade away when the mouse is stationary. |
47 void AddStationaryPoint(); | 52 void AddStationaryPoint(); |
48 | 53 |
49 // Timer which will add a new stationary point when the mouse stops moving. | 54 // Timer which will add a new stationary point when the mouse stops moving. |
50 // This will remove points that are too old. | 55 // This will remove points that are too old. |
51 std::unique_ptr<base::Timer> timer_; | 56 std::unique_ptr<base::Timer> timer_; |
52 int timer_repeat_count_ = 0; | 57 int timer_repeat_count_ = 0; |
53 | 58 |
54 gfx::Point current_mouse_location_; | 59 gfx::Point current_mouse_location_; |
55 std::unique_ptr<LaserPointerView> laser_pointer_view_; | 60 std::unique_ptr<LaserPointerView> laser_pointer_view_; |
56 | 61 |
57 DISALLOW_COPY_AND_ASSIGN(LaserPointerMode); | 62 DISALLOW_COPY_AND_ASSIGN(LaserPointerMode); |
58 }; | 63 }; |
59 | 64 |
60 } // namespace ash | 65 } // namespace ash |
61 | 66 |
62 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ | 67 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ |
OLD | NEW |