| 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 "base/containers/scoped_ptr_hash_map.h" | 8 #include <map> |
| 9 |
| 9 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 10 | 11 |
| 11 namespace ui { | 12 namespace ui { |
| 12 | 13 |
| 13 class DriWindowDelegate; | 14 class DriWindow; |
| 14 | 15 |
| 16 // Responsible for keeping the mapping between the allocated widgets and |
| 17 // windows. |
| 15 class DriWindowManager { | 18 class DriWindowManager { |
| 16 public: | 19 public: |
| 17 DriWindowManager(); | 20 DriWindowManager(); |
| 18 ~DriWindowManager(); | 21 ~DriWindowManager(); |
| 19 | 22 |
| 20 gfx::AcceleratedWidget NextAcceleratedWidget(); | 23 gfx::AcceleratedWidget NextAcceleratedWidget(); |
| 21 | 24 |
| 22 // Adds a delegate for |widget|. Note: |widget| should not be associated with | 25 // Adds a window for |widget|. Note: |widget| should not be associated when |
| 23 // a delegate when calling this function. | 26 // calling this function. |
| 24 void AddWindowDelegate(gfx::AcceleratedWidget widget, | 27 void AddWindow(gfx::AcceleratedWidget widget, DriWindow* window); |
| 25 scoped_ptr<DriWindowDelegate> surface); | |
| 26 | 28 |
| 27 // Removes the delegate for |widget|. Note: |widget| must have a delegate | 29 // Removes the window association for |widget|. Note: |widget| must be |
| 28 // associated with it when calling this function. | 30 // associated with a window when calling this function. |
| 29 scoped_ptr<DriWindowDelegate> RemoveWindowDelegate( | 31 void RemoveWindow(gfx::AcceleratedWidget widget); |
| 30 gfx::AcceleratedWidget widget); | |
| 31 | 32 |
| 32 // Returns the delegate associated with |widget|. Note: This function should | 33 // Returns the window associated with |widget|. Note: This function should |
| 33 // be called only if a valid delegate has been associated with |widget|. | 34 // only be called if a valid window has been associated. |
| 34 DriWindowDelegate* GetWindowDelegate(gfx::AcceleratedWidget widget); | 35 DriWindow* GetWindow(gfx::AcceleratedWidget widget); |
| 35 | |
| 36 // Check if |widget| has a valid delegate associated with it. | |
| 37 bool HasWindowDelegate(gfx::AcceleratedWidget widget); | |
| 38 | 36 |
| 39 private: | 37 private: |
| 40 typedef base::ScopedPtrHashMap<gfx::AcceleratedWidget, DriWindowDelegate> | 38 typedef std::map<gfx::AcceleratedWidget, DriWindow*> WidgetToWindowMap; |
| 41 WidgetToDelegateMap; | |
| 42 | 39 |
| 43 WidgetToDelegateMap delegate_map_; | |
| 44 gfx::AcceleratedWidget last_allocated_widget_; | 40 gfx::AcceleratedWidget last_allocated_widget_; |
| 41 WidgetToWindowMap window_map_; |
| 45 | 42 |
| 46 DISALLOW_COPY_AND_ASSIGN(DriWindowManager); | 43 DISALLOW_COPY_AND_ASSIGN(DriWindowManager); |
| 47 }; | 44 }; |
| 48 | 45 |
| 49 } // namespace ui | 46 } // namespace ui |
| 50 | 47 |
| 51 #endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_ | 48 #endif // UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_ |
| OLD | NEW |