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 // Updates |laser_pointer_view_| by changing its root window or creating it if | |
58 // needed. Also adds the latest point at |event_location|, stops propagation | |
59 // of |event| and starts the timer if required. | |
60 void UpdateLaserPointerView(aura::Window* current_window, | |
jdufault
2016/10/14 21:59:47
Update comment (no more timer section).
sammiequon
2016/10/17 19:12:24
Done.
| |
61 const gfx::Point& event_location, | |
62 ui::MouseEvent* event); | |
63 | |
64 // Destroys |laser_pointer_view_|, if it exists. | |
65 void DestroyLaserPointerView(); | |
66 | |
67 void RestartTimer(); | |
68 | |
57 // Timer which will add a new stationary point when the mouse stops moving. | 69 // Timer which will add a new stationary point when the mouse stops moving. |
58 // This will remove points that are too old. | 70 // This will remove points that are too old. |
59 std::unique_ptr<base::Timer> stationary_timer_; | 71 std::unique_ptr<base::Timer> stationary_timer_; |
60 int stationary_timer_repeat_count_ = 0; | 72 int stationary_timer_repeat_count_ = 0; |
61 | 73 |
62 bool enabled_ = false; | 74 bool enabled_ = false; |
63 | 75 |
76 // |is_fading_away_| determines whether the laser pointer view should accept | |
77 // points normally, or just advance the |laser_points_| time so that current | |
78 // points start fading away. This should be set to true when the view is about | |
79 // to be destroyed, such as when the stylus is released. | |
80 bool is_fading_away_ = false; | |
81 | |
64 // The last seen mouse location in screen coordinates. | 82 // The last seen mouse location in screen coordinates. |
65 gfx::Point current_mouse_location_; | 83 gfx::Point current_mouse_location_; |
66 | 84 |
67 // |laser_pointer_view_| will only hold an instance when the laser pointer is | 85 // |laser_pointer_view_| will only hold an instance when the laser pointer is |
68 // enabled and activated (pressed or dragged). | 86 // enabled and activated (pressed or dragged). |
69 std::unique_ptr<LaserPointerView> laser_pointer_view_; | 87 std::unique_ptr<LaserPointerView> laser_pointer_view_; |
70 | 88 |
71 DISALLOW_COPY_AND_ASSIGN(LaserPointerController); | 89 DISALLOW_COPY_AND_ASSIGN(LaserPointerController); |
72 }; | 90 }; |
73 | 91 |
74 } // namespace ash | 92 } // namespace ash |
75 | 93 |
76 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_ | 94 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_ |
OLD | NEW |