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_LASER_LASER_POINTER_CONTROLLER_H_ | 5 #ifndef ASH_LASER_LASER_POINTER_CONTROLLER_H_ |
6 #define ASH_LASER_LASER_POINTER_CONTROLLER_H_ | 6 #define ASH_LASER_LASER_POINTER_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 void OnWindowDestroying(aura::Window* window) override; | 47 void OnWindowDestroying(aura::Window* window) override; |
48 | 48 |
49 // Reparent, recreate or destroy LaserPointerView instance as needed based on | 49 // Reparent, recreate or destroy LaserPointerView instance as needed based on |
50 // the current window and the widgets window. | 50 // the current window and the widgets window. |
51 void SwitchTargetRootWindowIfNeeded(aura::Window* root_window); | 51 void SwitchTargetRootWindowIfNeeded(aura::Window* root_window); |
52 | 52 |
53 // Timer callback which adds a point where the mouse was last seen. This | 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. | 54 // allows the trail to fade away when the mouse is stationary. |
55 void AddStationaryPoint(); | 55 void AddStationaryPoint(); |
56 | 56 |
| 57 // Destroys |laser_pointer_view_|, if it exists. |
| 58 void DestroyLaserPointerView(); |
| 59 |
57 // Timer which will add a new stationary point when the mouse stops moving. | 60 // Timer which will add a new stationary point when the mouse stops moving. |
58 // This will remove points that are too old. | 61 // This will remove points that are too old. |
59 std::unique_ptr<base::Timer> stationary_timer_; | 62 std::unique_ptr<base::Timer> stationary_timer_; |
60 int stationary_timer_repeat_count_ = 0; | 63 int stationary_timer_repeat_count_ = 0; |
61 | 64 |
62 bool enabled_ = false; | 65 bool enabled_ = false; |
63 | 66 |
| 67 // |is_fading_away_| determines whether the laser pointer view should accept |
| 68 // points normally, or just advance the |laser_points_| time so that current |
| 69 // points start fading away. This should be set to true when the view is about |
| 70 // to be destroyed, such as when the stylus is released. |
| 71 bool is_fading_away_ = false; |
| 72 |
64 // The last seen mouse location in screen coordinates. | 73 // The last seen mouse location in screen coordinates. |
65 gfx::Point current_mouse_location_; | 74 gfx::Point current_mouse_location_; |
66 | 75 |
67 // |laser_pointer_view_| will only hold an instance when the laser pointer is | 76 // |laser_pointer_view_| will only hold an instance when the laser pointer is |
68 // enabled and activated (pressed or dragged). | 77 // enabled and activated (pressed or dragged). |
69 std::unique_ptr<LaserPointerView> laser_pointer_view_; | 78 std::unique_ptr<LaserPointerView> laser_pointer_view_; |
70 | 79 |
71 DISALLOW_COPY_AND_ASSIGN(LaserPointerController); | 80 DISALLOW_COPY_AND_ASSIGN(LaserPointerController); |
72 }; | 81 }; |
73 | 82 |
74 } // namespace ash | 83 } // namespace ash |
75 | 84 |
76 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_ | 85 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_ |
OLD | NEW |