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_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_VIEW_H_ | 5 #ifndef ASH_LASER_LASER_POINTER_VIEW_H_ |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_VIEW_H_ | 6 #define ASH_LASER_LASER_POINTER_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/common/system/chromeos/palette/tools/laser_pointer_points.h" | 10 #include "ash/laser/laser_pointer_points.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
13 | 13 |
| 14 namespace aura { |
| 15 class Window; |
| 16 } |
| 17 |
14 namespace gfx { | 18 namespace gfx { |
15 class Point; | 19 class Point; |
16 } | 20 } |
17 | 21 |
18 namespace views { | 22 namespace views { |
19 class Widget; | 23 class Widget; |
20 } | 24 } |
21 | 25 |
22 namespace ash { | 26 namespace ash { |
23 | 27 |
24 // LaserPointerView displays the palette tool laser pointer. It draws the laser, | 28 // LaserPointerView displays the palette tool laser pointer. It draws the laser, |
25 // which consists of a point where the mouse cursor should be, as well as a | 29 // which consists of a point where the mouse cursor should be, as well as a |
26 // trail of lines to help users track. | 30 // trail of lines to help users track. |
27 class LaserPointerView : public views::View { | 31 class LaserPointerView : public views::View { |
28 public: | 32 public: |
29 explicit LaserPointerView(base::TimeDelta life_duration); | 33 LaserPointerView(base::TimeDelta life_duration, aura::Window* root_window); |
30 ~LaserPointerView() override; | 34 ~LaserPointerView() override; |
31 | 35 |
32 void AddNewPoint(const gfx::Point& new_point); | 36 void AddNewPoint(const gfx::Point& new_point); |
33 void Stop(); | 37 void Stop(); |
| 38 aura::Window* GetRootWindow(); |
| 39 |
| 40 // Reparents the widget if needed. |
| 41 void ReparentWidget(aura::Window* new_root_window); |
34 | 42 |
35 private: | 43 private: |
36 friend class LaserPointerModeTestApi; | 44 friend class LaserPointerControllerTestApi; |
37 | 45 |
38 // view::View: | 46 // view::View: |
39 void OnPaint(gfx::Canvas* canvas) override; | 47 void OnPaint(gfx::Canvas* canvas) override; |
40 | 48 |
41 LaserPointerPoints laser_points_; | 49 LaserPointerPoints laser_points_; |
42 std::unique_ptr<views::Widget> widget_; | 50 std::unique_ptr<views::Widget> widget_; |
43 | 51 |
44 DISALLOW_COPY_AND_ASSIGN(LaserPointerView); | 52 DISALLOW_COPY_AND_ASSIGN(LaserPointerView); |
45 }; | 53 }; |
46 | 54 |
47 } // namespace ash | 55 } // namespace ash |
48 | 56 |
49 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_TOOLS_LASER_POINTER_VIEW_H_ | 57 #endif // ASH_LASER_LASER_POINTER_VIEW_H_ |
OLD | NEW |