OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ | 6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class Rect; | 22 class Rect; |
23 } | 23 } |
24 | 24 |
25 namespace ui { | 25 namespace ui { |
26 | 26 |
27 class BitmapCursorOzone; | 27 class BitmapCursorOzone; |
28 class BitmapCursorFactoryOzone; | 28 class BitmapCursorFactoryOzone; |
29 class DrmGpuPlatformSupportHost; | 29 class DrmGpuPlatformSupportHost; |
30 class DrmWindowHostManager; | 30 class DrmWindowHostManager; |
31 | 31 |
32 class DrmCursor : public CursorDelegateEvdev, public GpuPlatformSupportHost { | 32 class DrmCursor : public CursorDelegateEvdev { |
33 public: | 33 public: |
34 explicit DrmCursor(DrmWindowHostManager* window_manager); | 34 explicit DrmCursor(DrmWindowHostManager* window_manager); |
35 ~DrmCursor() override; | 35 ~DrmCursor() override; |
36 | 36 |
37 // Change the cursor over the specifed window. | 37 // Change the cursor over the specifed window. |
38 void SetCursor(gfx::AcceleratedWidget window, PlatformCursor platform_cursor); | 38 void SetCursor(gfx::AcceleratedWidget window, PlatformCursor platform_cursor); |
39 | 39 |
40 // Handle window lifecycle. | 40 // Handle window lifecycle. |
41 void OnWindowAdded(gfx::AcceleratedWidget window, | 41 void OnWindowAdded(gfx::AcceleratedWidget window, |
42 const gfx::Rect& bounds_in_screen, | 42 const gfx::Rect& bounds_in_screen, |
(...skipping 12 matching lines...) Expand all Loading... |
55 | 55 |
56 // CursorDelegateEvdev: | 56 // CursorDelegateEvdev: |
57 void MoveCursorTo(gfx::AcceleratedWidget window, | 57 void MoveCursorTo(gfx::AcceleratedWidget window, |
58 const gfx::PointF& location) override; | 58 const gfx::PointF& location) override; |
59 void MoveCursorTo(const gfx::PointF& screen_location) override; | 59 void MoveCursorTo(const gfx::PointF& screen_location) override; |
60 void MoveCursor(const gfx::Vector2dF& delta) override; | 60 void MoveCursor(const gfx::Vector2dF& delta) override; |
61 bool IsCursorVisible() override; | 61 bool IsCursorVisible() override; |
62 gfx::PointF GetLocation() override; | 62 gfx::PointF GetLocation() override; |
63 gfx::Rect GetCursorConfinedBounds() override; | 63 gfx::Rect GetCursorConfinedBounds() override; |
64 | 64 |
65 // GpuPlatformSupportHost: | 65 // IPC. |
66 void OnChannelEstablished( | 66 void OnChannelEstablished( |
67 int host_id, | 67 int host_id, |
68 scoped_refptr<base::SingleThreadTaskRunner> send_runner, | 68 scoped_refptr<base::SingleThreadTaskRunner> send_runner, |
69 const base::Callback<void(IPC::Message*)>& sender) override; | 69 const base::Callback<void(IPC::Message*)>& sender); |
70 void OnChannelDestroyed(int host_id) override; | 70 void OnChannelDestroyed(int host_id); |
71 | 71 bool OnMessageReceived(const IPC::Message& message); |
72 // IPC::Listener: | |
73 bool OnMessageReceived(const IPC::Message& message) override; | |
74 | 72 |
75 private: | 73 private: |
76 // Set the location (clamps to cursor bounds). | 74 // Set the location (clamps to cursor bounds). |
77 void SetCursorLocationLocked(const gfx::PointF& location); | 75 void SetCursorLocationLocked(const gfx::PointF& location); |
78 | 76 |
79 // The location of the bitmap (the cursor location is the hotspot location). | 77 // The location of the bitmap (the cursor location is the hotspot location). |
80 gfx::Point GetBitmapLocationLocked(); | 78 gfx::Point GetBitmapLocationLocked(); |
81 | 79 |
82 // IPC-related functions. | 80 // IPC-related functions. |
83 bool IsConnectedLocked(); | 81 bool IsConnectedLocked(); |
84 void SendCursorShowLocked(); | 82 void SendCursorShowLocked(); |
85 void SendCursorHideLocked(); | 83 void SendCursorHideLocked(); |
86 void SendCursorMoveLocked(); | 84 void SendCursorMoveLocked(); |
87 void SendLocked(IPC::Message* message); | 85 void SendLocked(IPC::Message* message); |
88 | 86 |
89 DrmWindowHostManager* window_manager_; // Not owned. | 87 DrmWindowHostManager* window_manager_; // Not owned. |
90 | 88 |
91 // Task runner for main thread. | 89 // Task runner for main thread. |
92 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 90 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
93 | 91 |
94 struct CursorState { | 92 struct CursorState { |
95 CursorState(); | 93 CursorState(); |
96 ~CursorState(); | 94 ~CursorState(); |
97 | 95 |
98 // The current cursor bitmap (immutable). | 96 // The current cursor bitmap (immutable). |
99 scoped_refptr<BitmapCursorOzone> bitmap; | 97 scoped_refptr<BitmapCursorOzone> bitmap; |
(...skipping 19 matching lines...) Expand all Loading... |
119 // The mutex synchronizing this object. | 117 // The mutex synchronizing this object. |
120 base::Lock lock; | 118 base::Lock lock; |
121 }; | 119 }; |
122 | 120 |
123 CursorState state_; | 121 CursorState state_; |
124 }; | 122 }; |
125 | 123 |
126 } // namespace ui | 124 } // namespace ui |
127 | 125 |
128 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ | 126 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_CURSOR_H_ |
OLD | NEW |