| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" |
| 12 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 13 #include "ui/events/event_handler.h" | 14 #include "ui/events/event_handler.h" |
| 14 #include "ui/gfx/geometry/point_f.h" | 15 #include "ui/gfx/geometry/point_f.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class Timer; | 18 class Timer; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 | 22 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Destroys |laser_pointer_view_|, if it exists. | 60 // Destroys |laser_pointer_view_|, if it exists. |
| 60 void DestroyLaserPointerView(); | 61 void DestroyLaserPointerView(); |
| 61 | 62 |
| 62 void RestartTimer(); | 63 void RestartTimer(); |
| 63 | 64 |
| 64 // Timer which will add a new stationary point when the stylus stops moving. | 65 // Timer which will add a new stationary point when the stylus stops moving. |
| 65 // This will remove points that are too old. | 66 // This will remove points that are too old. |
| 66 std::unique_ptr<base::Timer> stationary_timer_; | 67 std::unique_ptr<base::Timer> stationary_timer_; |
| 67 int stationary_timer_repeat_count_ = 0; | 68 int stationary_timer_repeat_count_ = 0; |
| 68 | 69 |
| 70 // The presentation delay used for prediction by the laser pointer view. |
| 71 base::TimeDelta presentation_delay_; |
| 72 |
| 69 bool enabled_ = false; | 73 bool enabled_ = false; |
| 70 | 74 |
| 71 // |is_fading_away_| determines whether the laser pointer view should accept | 75 // |is_fading_away_| determines whether the laser pointer view should accept |
| 72 // points normally, or just advance the |laser_points_| time so that current | 76 // points normally, or just advance the |laser_points_| time so that current |
| 73 // points start fading away. This should be set to true when the view is about | 77 // points start fading away. This should be set to true when the view is about |
| 74 // to be destroyed, such as when the stylus is released. | 78 // to be destroyed, such as when the stylus is released. |
| 75 bool is_fading_away_ = false; | 79 bool is_fading_away_ = false; |
| 76 | 80 |
| 77 // The last seen stylus location in screen coordinates. | 81 // The last seen stylus location in screen coordinates. |
| 78 gfx::PointF current_stylus_location_; | 82 gfx::PointF current_stylus_location_; |
| 79 | 83 |
| 80 // |laser_pointer_view_| will only hold an instance when the laser pointer is | 84 // |laser_pointer_view_| will only hold an instance when the laser pointer is |
| 81 // enabled and activated (pressed or dragged). | 85 // enabled and activated (pressed or dragged). |
| 82 std::unique_ptr<LaserPointerView> laser_pointer_view_; | 86 std::unique_ptr<LaserPointerView> laser_pointer_view_; |
| 83 | 87 |
| 84 DISALLOW_COPY_AND_ASSIGN(LaserPointerController); | 88 DISALLOW_COPY_AND_ASSIGN(LaserPointerController); |
| 85 }; | 89 }; |
| 86 | 90 |
| 87 } // namespace ash | 91 } // namespace ash |
| 88 | 92 |
| 89 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_ | 93 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_ |
| OLD | NEW |