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

Unified Diff: views/controls/menu/menu_host_win.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_host_root_view.cc ('k') | views/controls/menu/menu_host_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_host_win.h
diff --git a/views/controls/menu/menu_host_win.h b/views/controls/menu/menu_host_win.h
index ec5d060ef0804a1e5788c248de93958554a59115..f7d9cb4c76a897c187eb6f5b4d4de8c715924730 100644
--- a/views/controls/menu/menu_host_win.h
+++ b/views/controls/menu/menu_host_win.h
@@ -6,6 +6,7 @@
#ifndef VIEWS_CONTROLS_MENU_MENU_HOST_WIN_H_
#define VIEWS_CONTROLS_MENU_MENU_HOST_WIN_H_
+#include "views/controls/menu/menu_host.h"
#include "views/widget/widget_win.h"
namespace views {
@@ -13,36 +14,41 @@ namespace views {
class SubmenuView;
// MenuHost implementation for windows.
-class MenuHost : public WidgetWin {
+class MenuHostWin : public WidgetWin, public MenuHost {
public:
- explicit MenuHost(SubmenuView* submenu);
-
- void Init(HWND parent,
- const gfx::Rect& bounds,
- View* contents_view,
- bool do_capture);
-
- gfx::NativeWindow GetNativeWindow() { return GetNativeView(); }
-
- void Show();
- virtual void Hide();
- virtual void HideWindow();
+ explicit MenuHostWin(SubmenuView* submenu);
+ virtual ~MenuHostWin();
+
+ // MenuHost overrides:
+ virtual void Init(HWND parent,
+ const gfx::Rect& bounds,
+ View* contents_view,
+ bool do_capture);
+ virtual bool IsMenuHostVisible();
+ virtual void ShowMenuHost(bool do_capture);
+ virtual void HideMenuHost();
+ virtual void DestroyMenuHost();
+ virtual void SetMenuHostBounds(const gfx::Rect& bounds);
+ virtual void ReleaseMenuHostCapture();
+ virtual gfx::NativeWindow GetMenuHostWindow();
+
+ // WidgetWin overrides:
+ virtual void OnDestroy();
virtual void OnCaptureChanged(HWND hwnd);
- void DoCapture();
- void ReleaseCapture();
+ virtual void OnCancelMode();
protected:
virtual RootView* CreateRootView();
- virtual void OnCancelMode();
-
// Overriden to return false, we do NOT want to release capture on mouse
// release.
virtual bool ReleaseCaptureOnMouseReleased();
private:
- // If true, we've been closed.
- bool closed_;
+ void DoCapture();
+
+ // If true, DestroyMenuHost has been invoked.
+ bool destroying_;
// If true, we own the capture and need to release it.
bool owns_capture_;
@@ -50,7 +56,7 @@ class MenuHost : public WidgetWin {
// The view we contain.
SubmenuView* submenu_;
- DISALLOW_COPY_AND_ASSIGN(MenuHost);
+ DISALLOW_COPY_AND_ASSIGN(MenuHostWin);
};
} // namespace views
« no previous file with comments | « views/controls/menu/menu_host_root_view.cc ('k') | views/controls/menu/menu_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698