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