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

Unified Diff: views/controls/menu/menu_host.h

Issue 1664001: Fixes possible crash if the window hosting a menu was closed while the (Closed)
Patch Set: Incorporated review feedback Created 10 years, 8 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
« no previous file with comments | « views/controls/menu/menu_controller.cc ('k') | views/controls/menu/menu_host_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_host.h
diff --git a/views/controls/menu/menu_host.h b/views/controls/menu/menu_host.h
new file mode 100755
index 0000000000000000000000000000000000000000..676a93b4c832071f8248820d6f51ebdf265726db
--- /dev/null
+++ b/views/controls/menu/menu_host.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef VIEWS_CONTROLS_MENU_MENU_HOST_H_
+#define VIEWS_CONTROLS_MENU_MENU_HOST_H_
+
+#include "gfx/native_widget_types.h"
+#include "gfx/rect.h"
+
+namespace views {
+
+class SubmenuView;
+class View;
+
+// SubmenuView uses a MenuHost to house the SubmenuView. MenuHost typically
+// extends the native Widget type, but is defined here for clarity of what
+// methods SubmenuView uses.
+//
+// SubmenuView owns the MenuHost. When SubmenuView is done with the MenuHost
+// |DestroyMenuHost| is invoked. The one exception to this is if the native
+// OS destroys the widget out from under us, in which case |MenuHostDestroyed|
+// is invoked back on the SubmenuView and the SubmenuView then drops references
+// to the MenuHost.
+class MenuHost {
+ public:
+ // Creates the platform specific MenuHost. Ownership passes to the caller.
+ static MenuHost* Create(SubmenuView* submenu_view);
+
+ // Initializes and shows the MenuHost.
+ virtual void Init(gfx::NativeWindow parent,
+ const gfx::Rect& bounds,
+ View* contents_view,
+ bool do_capture) = 0;
+
+ // Returns true if the menu host is visible.
+ virtual bool IsMenuHostVisible() = 0;
+
+ // Shows the menu host. If |do_capture| is true the menu host should do a
+ // mouse grab.
+ virtual void ShowMenuHost(bool do_capture) = 0;
+
+ // Hides the menu host.
+ virtual void HideMenuHost() = 0;
+
+ // Destroys and deletes the menu host.
+ virtual void DestroyMenuHost() = 0;
+
+ // Sets the bounds of the menu host.
+ virtual void SetMenuHostBounds(const gfx::Rect& bounds) = 0;
+
+ // Releases a mouse grab installed by |ShowMenuHost|.
+ virtual void ReleaseMenuHostCapture() = 0;
+
+ // Returns the native window of the MenuHost.
+ virtual gfx::NativeWindow GetMenuHostWindow() = 0;
+
+ protected:
+ virtual ~MenuHost() {}
+};
+
+} // namespace views
+
+#endif // VIEWS_CONTROLS_MENU_MENU_HOST_H_
« no previous file with comments | « views/controls/menu/menu_controller.cc ('k') | views/controls/menu/menu_host_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698