| 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_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 <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| 11 | 11 |
| 12 #include "ash/laser/laser_pointer_points.h" | 12 #include "ash/laser/laser_pointer_points.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "cc/ipc/compositor_frame.mojom.h" | 15 #include "cc/ipc/compositor_frame.mojom.h" |
| 16 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" | 16 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
| 17 #include "cc/resources/texture_mailbox.h" | 17 #include "cc/resources/texture_mailbox.h" |
| 18 #include "cc/surfaces/compositor_frame_sink_support.h" | 18 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 19 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 19 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| 20 #include "cc/surfaces/local_surface_id_allocator.h" | 20 #include "cc/surfaces/local_surface_id_allocator.h" |
| 21 #include "mojo/public/cpp/bindings/strong_binding.h" | 21 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 22 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
| 23 | 23 |
| 24 namespace aura { | 24 namespace aura { |
| 25 class Window; | 25 class Window; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace gfx { | 28 namespace gfx { |
| 29 class GpuMemoryBuffer; | 29 class GpuMemoryBuffer; |
| 30 class Point; | 30 class PointF; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace views { | 33 namespace views { |
| 34 class Widget; | 34 class Widget; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace ash { | 37 namespace ash { |
| 38 struct LaserResource; | 38 struct LaserResource; |
| 39 | 39 |
| 40 // LaserPointerView displays the palette tool laser pointer. It draws the laser, | 40 // LaserPointerView displays the palette tool laser pointer. It draws the laser, |
| 41 // which consists of a point where the mouse cursor should be, as well as a | 41 // which consists of a point where the mouse cursor should be, as well as a |
| 42 // trail of lines to help users track. | 42 // trail of lines to help users track. |
| 43 class LaserPointerView : public views::View, | 43 class LaserPointerView : public views::View, |
| 44 public cc::mojom::MojoCompositorFrameSink, | 44 public cc::mojom::MojoCompositorFrameSink, |
| 45 public cc::CompositorFrameSinkSupportClient { | 45 public cc::CompositorFrameSinkSupportClient { |
| 46 public: | 46 public: |
| 47 LaserPointerView(base::TimeDelta life_duration, aura::Window* root_window); | 47 LaserPointerView(base::TimeDelta life_duration, aura::Window* root_window); |
| 48 ~LaserPointerView() override; | 48 ~LaserPointerView() override; |
| 49 | 49 |
| 50 void AddNewPoint(const gfx::Point& new_point); | 50 void AddNewPoint(const gfx::PointF& new_point); |
| 51 void UpdateTime(); | 51 void UpdateTime(); |
| 52 void Stop(); | 52 void Stop(); |
| 53 | 53 |
| 54 // Overridden from cc::mojom::MojoCompositorFrameSink: | 54 // Overridden from cc::mojom::MojoCompositorFrameSink: |
| 55 void SetNeedsBeginFrame(bool needs_begin_frame) override; | 55 void SetNeedsBeginFrame(bool needs_begin_frame) override; |
| 56 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, | 56 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, |
| 57 cc::CompositorFrame frame) override; | 57 cc::CompositorFrame frame) override; |
| 58 void EvictFrame() override; | 58 void EvictFrame() override; |
| 59 void Require(const cc::LocalSurfaceId& local_surface_id, | 59 void Require(const cc::LocalSurfaceId& local_surface_id, |
| 60 const cc::SurfaceSequence& sequence) override; | 60 const cc::SurfaceSequence& sequence) override; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 std::unordered_map<int, std::unique_ptr<LaserResource>> resources_; | 94 std::unordered_map<int, std::unique_ptr<LaserResource>> resources_; |
| 95 std::deque<std::unique_ptr<LaserResource>> returned_resources_; | 95 std::deque<std::unique_ptr<LaserResource>> returned_resources_; |
| 96 base::WeakPtrFactory<LaserPointerView> weak_ptr_factory_; | 96 base::WeakPtrFactory<LaserPointerView> weak_ptr_factory_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(LaserPointerView); | 98 DISALLOW_COPY_AND_ASSIGN(LaserPointerView); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace ash | 101 } // namespace ash |
| 102 | 102 |
| 103 #endif // ASH_LASER_LASER_POINTER_VIEW_H_ | 103 #endif // ASH_LASER_LASER_POINTER_VIEW_H_ |
| OLD | NEW |