Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1348)

Side by Side Diff: ash/laser/laser_pointer_controller.h

Issue 2362063002: cros: Laser pointer fades out on release, do not cover palette. (Closed)
Patch Set: Fixed patch set 7 errors. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
61 const gfx::Point& event_location,
62 ui::MouseEvent* event,
63 bool start_timer);
64
65 // Destroys |laser_pointer_view_|, if it exists.
66 void DestroyLaserPointerView();
67
57 // Timer which will add a new stationary point when the mouse stops moving. 68 // Timer which will add a new stationary point when the mouse stops moving.
58 // This will remove points that are too old. 69 // This will remove points that are too old.
59 std::unique_ptr<base::Timer> stationary_timer_; 70 std::unique_ptr<base::Timer> stationary_timer_;
60 int stationary_timer_repeat_count_ = 0; 71 int stationary_timer_repeat_count_ = 0;
61 72
62 bool enabled_ = false; 73 bool enabled_ = false;
63 74
75 // |is_fading_away_| determines whether the laser pointer view should accept
76 // points normally, or just advance the |laser_points_| time so that current
77 // points start fading away. This should be set to true when the view is about
78 // to be destroyed, such as when the stylus is released.
79 bool is_fading_away_ = false;
80
64 // The last seen mouse location in screen coordinates. 81 // The last seen mouse location in screen coordinates.
65 gfx::Point current_mouse_location_; 82 gfx::Point current_mouse_location_;
66 83
67 // |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
68 // enabled and activated (pressed or dragged). 85 // enabled and activated (pressed or dragged).
69 std::unique_ptr<LaserPointerView> laser_pointer_view_; 86 std::unique_ptr<LaserPointerView> laser_pointer_view_;
70 87
71 DISALLOW_COPY_AND_ASSIGN(LaserPointerController); 88 DISALLOW_COPY_AND_ASSIGN(LaserPointerController);
72 }; 89 };
73 90
74 } // namespace ash 91 } // namespace ash
75 92
76 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_ 93 #endif // ASH_LASER_LASER_POINTER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/laser/laser_pointer_controller.cc » ('j') | ash/laser/laser_pointer_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698