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_DRI_DRI_WINDOW_MANAGER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_ |
6 #define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_ | 6 #define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
| 13 namespace gfx { |
| 14 class Point; |
| 15 } |
| 16 |
13 namespace ui { | 17 namespace ui { |
14 | 18 |
15 class DriCursor; | 19 class DriCursor; |
16 class DriGpuPlatformSupportHost; | 20 class DriGpuPlatformSupportHost; |
17 class DriWindow; | 21 class DriWindow; |
18 | 22 |
19 // Responsible for keeping the mapping between the allocated widgets and | 23 // Responsible for keeping the mapping between the allocated widgets and |
20 // windows. | 24 // windows. |
21 class DriWindowManager { | 25 class DriWindowManager { |
22 public: | 26 public: |
23 explicit DriWindowManager(DriGpuPlatformSupportHost* sender); | 27 explicit DriWindowManager(DriGpuPlatformSupportHost* sender); |
24 ~DriWindowManager(); | 28 ~DriWindowManager(); |
25 | 29 |
26 gfx::AcceleratedWidget NextAcceleratedWidget(); | 30 gfx::AcceleratedWidget NextAcceleratedWidget(); |
27 | 31 |
28 // Adds a window for |widget|. Note: |widget| should not be associated when | 32 // Adds a window for |widget|. Note: |widget| should not be associated when |
29 // calling this function. | 33 // calling this function. |
30 void AddWindow(gfx::AcceleratedWidget widget, DriWindow* window); | 34 void AddWindow(gfx::AcceleratedWidget widget, DriWindow* window); |
31 | 35 |
32 // Removes the window association for |widget|. Note: |widget| must be | 36 // Removes the window association for |widget|. Note: |widget| must be |
33 // associated with a window when calling this function. | 37 // associated with a window when calling this function. |
34 void RemoveWindow(gfx::AcceleratedWidget widget); | 38 void RemoveWindow(gfx::AcceleratedWidget widget); |
35 | 39 |
36 // Returns the window associated with |widget|. Note: This function should | 40 // Returns the window associated with |widget|. Note: This function should |
37 // only be called if a valid window has been associated. | 41 // only be called if a valid window has been associated. |
38 DriWindow* GetWindow(gfx::AcceleratedWidget widget); | 42 DriWindow* GetWindow(gfx::AcceleratedWidget widget); |
39 | 43 |
| 44 // Returns the window containing the specified screen location, or NULL. |
| 45 DriWindow* GetWindowAt(const gfx::Point& location); |
| 46 |
40 DriCursor* cursor() const { return cursor_.get(); } | 47 DriCursor* cursor() const { return cursor_.get(); } |
41 | 48 |
42 private: | 49 private: |
43 // Reset the cursor location based on the list of active windows. | 50 // Reset the cursor location based on the list of active windows. |
44 void ResetCursorLocation(); | 51 void ResetCursorLocation(); |
45 | 52 |
46 typedef std::map<gfx::AcceleratedWidget, DriWindow*> WidgetToWindowMap; | 53 typedef std::map<gfx::AcceleratedWidget, DriWindow*> WidgetToWindowMap; |
47 | 54 |
48 gfx::AcceleratedWidget last_allocated_widget_; | 55 gfx::AcceleratedWidget last_allocated_widget_; |
49 WidgetToWindowMap window_map_; | 56 WidgetToWindowMap window_map_; |
50 | 57 |
51 scoped_ptr<DriCursor> cursor_; | 58 scoped_ptr<DriCursor> cursor_; |
52 | 59 |
53 DISALLOW_COPY_AND_ASSIGN(DriWindowManager); | 60 DISALLOW_COPY_AND_ASSIGN(DriWindowManager); |
54 }; | 61 }; |
55 | 62 |
56 } // namespace ui | 63 } // namespace ui |
57 | 64 |
58 #endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_ | 65 #endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_ |
OLD | NEW |