Chromium Code Reviews| Index: ui/base/x/x11_util.h |
| diff --git a/ui/base/x/x11_util.h b/ui/base/x/x11_util.h |
| index dbcd987b9dd2984ac7b746302477c332c1602aeb..f38df6b0f790d70e1b3b7e857447d87783ea87ac 100644 |
| --- a/ui/base/x/x11_util.h |
| +++ b/ui/base/x/x11_util.h |
| @@ -29,6 +29,9 @@ typedef unsigned long Cursor; |
| typedef struct _XcursorImage XcursorImage; |
| typedef union _XEvent XEvent; |
| +// A process wide singleton cache for X menus. |
| +template <typename T> struct DefaultSingletonTraits; |
| + |
| #if defined(TOOLKIT_GTK) |
| typedef struct _GdkDrawable GdkWindow; |
| typedef struct _GtkWidget GtkWidget; |
| @@ -398,6 +401,31 @@ class UI_BASE_EXPORT XScopedCursor { |
| DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
| }; |
| +// Keeps track of created and destroyed top level menu windows. |
| +class UI_BASE_EXPORT XMenuList { |
|
sadrul
2014/03/26 18:01:07
Let's take it out of here and into a separate file
varkha
2014/03/27 04:48:13
Done.
|
| + public: |
| + static XMenuList* GetInstance(); |
| + |
| + // Checks if |menu| has _NET_WM_WINDOW_TYPE property set to |
| + // "_NET_WM_WINDOW_TYPE_MENU" atom and if so caches it. |
| + void MaybeRegisterMenu(XID menu); |
| + |
| + // Finds |menu| in cache and if found removes it. |
| + void MaybeUnregisterMenu(XID menu); |
| + |
| + // Inserts cached menu XIDs at the beginning of |stack|. |
| + void InsertMenuWindowXIDs(std::vector<XID>* stack); |
| + |
| + private: |
| + friend struct DefaultSingletonTraits<XMenuList>; |
| + XMenuList(); |
| + ~XMenuList(); |
| + |
| + std::vector<XID> menus_; |
| + ::Atom menu_type_atom_; |
| + DISALLOW_COPY_AND_ASSIGN(XMenuList); |
| +}; |
| + |
| } // namespace ui |
| #endif // UI_BASE_X_X11_UTIL_H_ |