OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_MANAGER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_MANAGER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/gfx/native_widget_types.h" |
| 12 |
| 13 namespace gfx { |
| 14 class Point; |
| 15 } |
| 16 |
| 17 namespace ui { |
| 18 |
| 19 class DrmGpuPlatformSupportHost; |
| 20 class DrmWindowHost; |
| 21 |
| 22 // Responsible for keeping the mapping between the allocated widgets and |
| 23 // windows. |
| 24 class DrmWindowHostManager { |
| 25 public: |
| 26 DrmWindowHostManager(); |
| 27 ~DrmWindowHostManager(); |
| 28 |
| 29 gfx::AcceleratedWidget NextAcceleratedWidget(); |
| 30 |
| 31 // Adds a window for |widget|. Note: |widget| should not be associated when |
| 32 // calling this function. |
| 33 void AddWindow(gfx::AcceleratedWidget widget, DrmWindowHost* window); |
| 34 |
| 35 // Removes the window association for |widget|. Note: |widget| must be |
| 36 // associated with a window when calling this function. |
| 37 void RemoveWindow(gfx::AcceleratedWidget widget); |
| 38 |
| 39 // Returns the window associated with |widget|. Note: This function should |
| 40 // only be called if a valid window has been associated. |
| 41 DrmWindowHost* GetWindow(gfx::AcceleratedWidget widget); |
| 42 |
| 43 // Returns the window containing the specified screen location, or NULL. |
| 44 DrmWindowHost* GetWindowAt(const gfx::Point& location); |
| 45 |
| 46 // Returns a window. Probably the first one created. |
| 47 DrmWindowHost* GetPrimaryWindow(); |
| 48 |
| 49 // Tries to set a given widget as the recipient for events. It will |
| 50 // fail if there is already another widget as recipient. |
| 51 void GrabEvents(gfx::AcceleratedWidget widget); |
| 52 |
| 53 // Unsets a given widget as the recipient for events. |
| 54 void UngrabEvents(gfx::AcceleratedWidget widget); |
| 55 |
| 56 // Gets the current widget recipient of mouse events. |
| 57 gfx::AcceleratedWidget event_grabber() const { return event_grabber_; } |
| 58 |
| 59 private: |
| 60 typedef std::map<gfx::AcceleratedWidget, DrmWindowHost*> WidgetToWindowMap; |
| 61 |
| 62 gfx::AcceleratedWidget last_allocated_widget_ = 0; |
| 63 WidgetToWindowMap window_map_; |
| 64 |
| 65 gfx::AcceleratedWidget event_grabber_ = gfx::kNullAcceleratedWidget; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(DrmWindowHostManager); |
| 68 }; |
| 69 |
| 70 } // namespace ui |
| 71 |
| 72 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_MANAGER_H_ |
OLD | NEW |