Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: ui/ozone/platform/dri/dri_window_manager.h

Issue 556073003: [Ozone-DRI] Do proper bounds checks when moving the cursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@restore-cursor
Patch Set: Earlier check for kNullAcceleratedWidget Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/dri/dri_window_manager.h
diff --git a/ui/ozone/platform/dri/dri_window_manager.h b/ui/ozone/platform/dri/dri_window_manager.h
index 7589530fab6fb76288311318e7cf318db5999fc5..64ed8f952a2da7301546bf03b35465863d24cb95 100644
--- a/ui/ozone/platform/dri/dri_window_manager.h
+++ b/ui/ozone/platform/dri/dri_window_manager.h
@@ -5,13 +5,16 @@
#ifndef UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_
#define UI_OZONE_PLATFORM_DRI_DRI_WINDOW_MANAGER_H_
-#include "base/containers/scoped_ptr_hash_map.h"
+#include <map>
+
#include "ui/gfx/native_widget_types.h"
namespace ui {
-class DriWindowDelegate;
+class DriWindow;
+// Responsible for keeping the mapping between the allocated widgets and
+// windows.
class DriWindowManager {
public:
DriWindowManager();
@@ -19,29 +22,23 @@ class DriWindowManager {
gfx::AcceleratedWidget NextAcceleratedWidget();
- // Adds a delegate for |widget|. Note: |widget| should not be associated with
- // a delegate when calling this function.
- void AddWindowDelegate(gfx::AcceleratedWidget widget,
- scoped_ptr<DriWindowDelegate> surface);
-
- // Removes the delegate for |widget|. Note: |widget| must have a delegate
- // associated with it when calling this function.
- scoped_ptr<DriWindowDelegate> RemoveWindowDelegate(
- gfx::AcceleratedWidget widget);
+ // Adds a window for |widget|. Note: |widget| should not be associated when
+ // calling this function.
+ void AddWindow(gfx::AcceleratedWidget widget, DriWindow* window);
- // Returns the delegate associated with |widget|. Note: This function should
- // be called only if a valid delegate has been associated with |widget|.
- DriWindowDelegate* GetWindowDelegate(gfx::AcceleratedWidget widget);
+ // Removes the window association for |widget|. Note: |widget| must be
+ // associated with a window when calling this function.
+ void RemoveWindow(gfx::AcceleratedWidget widget);
- // Check if |widget| has a valid delegate associated with it.
- bool HasWindowDelegate(gfx::AcceleratedWidget widget);
+ // Returns the window associated with |widget|. Note: This function should
+ // only be called if a valid window has been associated.
+ DriWindow* GetWindow(gfx::AcceleratedWidget widget);
private:
- typedef base::ScopedPtrHashMap<gfx::AcceleratedWidget, DriWindowDelegate>
- WidgetToDelegateMap;
+ typedef std::map<gfx::AcceleratedWidget, DriWindow*> WidgetToWindowMap;
- WidgetToDelegateMap delegate_map_;
gfx::AcceleratedWidget last_allocated_widget_;
+ WidgetToWindowMap window_map_;
DISALLOW_COPY_AND_ASSIGN(DriWindowManager);
};

Powered by Google App Engine
This is Rietveld 408576698