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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 VIEWS_CONTROLS_MENU_MENU_HOST_H_
6 #define VIEWS_CONTROLS_MENU_MENU_HOST_H_
7
8 #include "gfx/native_widget_types.h"
9 #include "gfx/rect.h"
10
11 namespace views {
12
13 class SubmenuView;
14 class View;
15
16 // SubmenuView uses a MenuHost to house the SubmenuView. MenuHost typically
17 // extends the native Widget type, but is defined here for clarity of what
18 // methods SubmenuView uses.
19 //
20 // SubmenuView owns the MenuHost. When SubmenuView is done with the MenuHost
21 // |DestroyMenuHost| is invoked. The one exception to this is if the native
22 // OS destroys the widget out from under us, in which case |MenuHostDestroyed|
23 // is invoked back on the SubmenuView and the SubmenuView then drops references
24 // to the MenuHost.
25 class MenuHost {
26 public:
27 // Creates the platform specific MenuHost. Ownership passes to the caller.
28 static MenuHost* Create(SubmenuView* submenu_view);
29
30 // Initializes and shows the MenuHost.
31 virtual void Init(gfx::NativeWindow parent,
32 const gfx::Rect& bounds,
33 View* contents_view,
34 bool do_capture) = 0;
35
36 // Returns true if the menu host is visible.
37 virtual bool IsMenuHostVisible() = 0;
38
39 // Shows the menu host. If |do_capture| is true the menu host should do a
40 // mouse grab.
41 virtual void ShowMenuHost(bool do_capture) = 0;
42
43 // Hides the menu host.
44 virtual void HideMenuHost() = 0;
45
46 // Destroys and deletes the menu host.
47 virtual void DestroyMenuHost() = 0;
48
49 // Sets the bounds of the menu host.
50 virtual void SetMenuHostBounds(const gfx::Rect& bounds) = 0;
51
52 // Releases a mouse grab installed by |ShowMenuHost|.
53 virtual void ReleaseMenuHostCapture() = 0;
54
55 // Returns the native window of the MenuHost.
56 virtual gfx::NativeWindow GetMenuHostWindow() = 0;
57
58 protected:
59 virtual ~MenuHost() {}
60 };
61
62 } // namespace views
63
64 #endif // VIEWS_CONTROLS_MENU_MENU_HOST_H_
OLDNEW
« 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