OLD | NEW |
---|---|
(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_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ | |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ | |
7 | |
8 #include "ash/common/system/chromeos/palette/common_palette_tool.h" | |
9 #include "ash/common/system/chromeos/palette/tools/laser_pointer_points.h" | |
10 #include "ash/common/system/chromeos/palette/tools/laser_pointer_view.h" | |
11 #include "ui/views/pointer_watcher.h" | |
12 | |
13 namespace ash { | |
14 | |
15 class LaserPointerMode : public CommonPaletteTool, | |
16 public views::PointerWatcher { | |
17 public: | |
18 explicit LaserPointerMode(Delegate* delegate); | |
19 ~LaserPointerMode() override; | |
20 | |
21 protected: | |
jdufault
2016/08/11 23:41:54
Make this all private.
If you need access inside
| |
22 // Timer which will add a new stationary point when the mouse stops moving. | |
23 // This will remove points past a certain threshold. | |
24 std::unique_ptr<base::Timer> timer_; | |
25 base::Lock points_lock_; | |
26 int timer_repeat_count_; | |
27 | |
28 gfx::Point current_mouse_location_; | |
29 LaserPointerPoints laser_points_; | |
30 LaserPointerView* laser_pointer_view_ = nullptr; | |
31 | |
32 private: | |
33 // PaletteTool overrides. | |
jdufault
2016/08/11 23:41:54
// PaletteTool:
| |
34 PaletteGroup GetGroup() const override; | |
35 PaletteToolId GetToolId() const override; | |
36 void OnEnable() override; | |
37 void OnDisable() override; | |
38 gfx::VectorIconId GetActiveTrayIcon() override; | |
39 | |
40 // CommonPaletteTool overrides. | |
41 gfx::VectorIconId GetPaletteIconId() override; | |
42 // views::PointerWatcher: | |
43 void OnPointerEventObserved(const ui::PointerEvent& event, | |
44 const gfx::Point& location_in_screen, | |
45 views::Widget* target) override; | |
46 | |
47 void InitializeTimer(); | |
48 void StartTimer(); | |
49 void StopTimer(); | |
50 // Timer callback which adds a point where the mouse was last seen. This takes | |
51 // care of fading away the tail of the laser when the mouse is stationary. | |
52 void AddStationaryPoint(); | |
53 | |
54 static const int kAddStationaryPointsDelayMs; | |
jdufault
2016/08/11 23:41:54
Move to cc file in an anonymous namespace.
| |
55 static const int kPointLifeDurationMs; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(LaserPointerMode); | |
58 }; | |
59 | |
60 } // namespace ash | |
61 | |
62 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_MODE_H_ | |
OLD | NEW |