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