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