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

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

Issue 2362063002: cros: Laser pointer fades out on release, do not cover palette. (Closed)
Patch Set: Moved age logic to laser pointer points class. 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_VIEW_H_ 5 #ifndef ASH_LASER_LASER_POINTER_VIEW_H_
6 #define ASH_LASER_LASER_POINTER_VIEW_H_ 6 #define ASH_LASER_LASER_POINTER_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9
10 #include "ash/laser/laser_pointer_points.h" 9 #include "ash/laser/laser_pointer_points.h"
jdufault 2016/10/04 22:04:13 nit: restore newline
sammiequon 2016/10/05 17:42:23 Done.
11 #include "base/macros.h" 10 #include "base/macros.h"
12 #include "ui/views/view.h" 11 #include "ui/views/view.h"
13 12
14 namespace aura { 13 namespace aura {
15 class Window; 14 class Window;
16 } 15 }
17 16
18 namespace gfx { 17 namespace gfx {
19 class Point; 18 class Point;
20 } 19 }
21 20
22 namespace views { 21 namespace views {
23 class Widget; 22 class Widget;
24 } 23 }
25 24
26 namespace ash { 25 namespace ash {
27 26
28 // LaserPointerView displays the palette tool laser pointer. It draws the laser, 27 // LaserPointerView displays the palette tool laser pointer. It draws the laser,
29 // which consists of a point where the mouse cursor should be, as well as a 28 // which consists of a point where the mouse cursor should be, as well as a
30 // trail of lines to help users track. 29 // trail of lines to help users track.
31 class LaserPointerView : public views::View { 30 class LaserPointerView : public views::View {
32 public: 31 public:
33 LaserPointerView(base::TimeDelta life_duration, aura::Window* root_window); 32 LaserPointerView(base::TimeDelta life_duration, aura::Window* root_window);
34 ~LaserPointerView() override; 33 ~LaserPointerView() override;
35 34
36 void AddNewPoint(const gfx::Point& new_point); 35 void AddNewPoint(const gfx::Point& new_point, bool fading_away);
37 void Stop(); 36 void Stop();
37
38 aura::Window* GetRootWindow(); 38 aura::Window* GetRootWindow();
39 39
40 // Reparents the widget if needed. 40 // Reparents the widget if needed.
41 void ReparentWidget(aura::Window* new_root_window); 41 void ReparentWidget(aura::Window* new_root_window);
42 42
43 private: 43 private:
44 friend class LaserPointerControllerTestApi; 44 friend class LaserPointerControllerTestApi;
45 45
46 // view::View: 46 // view::View:
47 void OnPaint(gfx::Canvas* canvas) override; 47 void OnPaint(gfx::Canvas* canvas) override;
48 48
49 LaserPointerPoints laser_points_; 49 LaserPointerPoints laser_points_;
50 std::unique_ptr<views::Widget> widget_; 50 std::unique_ptr<views::Widget> widget_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(LaserPointerView); 52 DISALLOW_COPY_AND_ASSIGN(LaserPointerView);
53 }; 53 };
54 54
55 } // namespace ash 55 } // namespace ash
56 56
57 #endif // ASH_LASER_LASER_POINTER_VIEW_H_ 57 #endif // ASH_LASER_LASER_POINTER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698