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