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

Unified Diff: views/controls/menu/menu_host_gtk.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.h ('k') | views/controls/menu/menu_host_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_host_gtk.h
diff --git a/views/controls/menu/menu_host_gtk.h b/views/controls/menu/menu_host_gtk.h
index 4ae1b77d0266d5bfd0c99e8940b85256cd762687..97223f837a40d0d206899b45383c54e7eac1fbc0 100644
--- a/views/controls/menu/menu_host_gtk.h
+++ b/views/controls/menu/menu_host_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,6 +6,7 @@
#ifndef VIEWS_CONTROLS_MENU_MENU_HOST_GTK_H_
#define VIEWS_CONTROLS_MENU_MENU_HOST_GTK_H_
+#include "views/controls/menu/menu_host.h"
#include "views/widget/widget_gtk.h"
namespace views {
@@ -13,28 +14,27 @@ namespace views {
class SubmenuView;
// MenuHost implementation for Gtk.
-class MenuHost : public WidgetGtk {
+class MenuHostGtk : public WidgetGtk, public MenuHost {
public:
- explicit MenuHost(SubmenuView* submenu);
+ explicit MenuHostGtk(SubmenuView* submenu);
+ virtual ~MenuHostGtk();
+ // MenuHost overrides.
void Init(gfx::NativeWindow parent,
const gfx::Rect& bounds,
View* contents_view,
bool do_capture);
-
- gfx::NativeWindow GetNativeWindow();
-
- void Show();
- virtual void Hide();
- virtual void HideWindow();
- void DoCapture();
- void ReleaseCapture();
+ 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();
protected:
virtual RootView* CreateRootView();
- virtual gboolean OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event);
-
// Overriden to return false, we do NOT want to release capture on mouse
// release.
virtual bool ReleaseCaptureOnMouseReleased();
@@ -42,9 +42,14 @@ class MenuHost : public WidgetGtk {
// Overriden to also release pointer grab.
virtual void ReleaseGrab();
+ virtual void OnDestroy(GtkWidget* object);
+ virtual gboolean OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event);
+
private:
- // If true, we've been closed.
- bool closed_;
+ void DoCapture();
+
+ // If true, DestroyMenuHost has been invoked.
+ bool destroying_;
// The view we contain.
SubmenuView* submenu_;
@@ -52,7 +57,7 @@ class MenuHost : public WidgetGtk {
// Have we done a pointer grab?
bool did_pointer_grab_;
- DISALLOW_COPY_AND_ASSIGN(MenuHost);
+ DISALLOW_COPY_AND_ASSIGN(MenuHostGtk);
};
} // namespace views
« no previous file with comments | « views/controls/menu/menu_host.h ('k') | views/controls/menu/menu_host_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698