summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 00:10:58 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 00:10:58 +0000
commit3a64a092773e04f1e46c7d8c524a76a2db7c5c30 (patch)
tree14af2dabe330592e860702092a8a849180aafabc /views
parentb5e460e945d914ebde60aa9f65df4c06af4e393b (diff)
downloadchromium_src-3a64a092773e04f1e46c7d8c524a76a2db7c5c30.zip
chromium_src-3a64a092773e04f1e46c7d8c524a76a2db7c5c30.tar.gz
chromium_src-3a64a092773e04f1e46c7d8c524a76a2db7c5c30.tar.bz2
Views: fix a crash where in the browser actions container.
This crash didn't actually affect linux/views (for some reason the RunContextMenu() call seems to never return). BUG=38964 TEST=crash an extension while the context menu for it is showing. Review URL: http://codereview.chromium.org/1237004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/native_menu_gtk.cc27
-rw-r--r--views/controls/menu/native_menu_gtk.h8
2 files changed, 16 insertions, 19 deletions
diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc
index 012d2a8..a10e130 100644
--- a/views/controls/menu/native_menu_gtk.cc
+++ b/views/controls/menu/native_menu_gtk.cc
@@ -112,11 +112,11 @@ void NativeMenuGtk::RunMenuAt(const gfx::Point& point, int alignment) {
// Listen for "hide" signal so that we know when to return from the blocking
// RunMenuAt call.
gint hide_handle_id =
- g_signal_connect(menu_, "hide", G_CALLBACK(OnMenuHidden), this);
+ g_signal_connect(menu_, "hide", G_CALLBACK(OnMenuHiddenThunk), this);
gint move_handle_id =
- g_signal_connect(menu_, "move-current", G_CALLBACK(OnMenuMoveCurrent),
- this);
+ g_signal_connect(menu_, "move-current",
+ G_CALLBACK(OnMenuMoveCurrentThunk), this);
// Block until menu is no longer shown by running a nested message loop.
MessageLoopForUI::current()->Run(NULL);
@@ -133,7 +133,7 @@ void NativeMenuGtk::RunMenuAt(const gfx::Point& point, int alignment) {
}
void NativeMenuGtk::CancelMenu() {
- NOTIMPLEMENTED();
+ gtk_widget_hide(menu_);
}
void NativeMenuGtk::Rebuild() {
@@ -208,9 +208,8 @@ void NativeMenuGtk::RemoveMenuListener(MenuListener* listener) {
////////////////////////////////////////////////////////////////////////////////
// NativeMenuGtk, private:
-// static
-void NativeMenuGtk::OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu) {
- if (!menu->menu_shown_) {
+void NativeMenuGtk::OnMenuHidden(GtkWidget* widget) {
+ if (!menu_shown_) {
// This indicates we don't have a menu open, and should never happen.
NOTREACHED();
return;
@@ -219,10 +218,8 @@ void NativeMenuGtk::OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu) {
MessageLoop::current()->Quit();
}
-// static
-void NativeMenuGtk::OnMenuMoveCurrent(GtkMenu* menu_widget,
- GtkMenuDirectionType focus_direction,
- NativeMenuGtk* menu) {
+void NativeMenuGtk::OnMenuMoveCurrent(GtkWidget* menu_widget,
+ GtkMenuDirectionType focus_direction) {
GtkWidget* parent = GTK_MENU_SHELL(menu_widget)->parent_menu_shell;
GtkWidget* menu_item = GTK_MENU_SHELL(menu_widget)->active_menu_item;
GtkWidget* submenu = NULL;
@@ -231,11 +228,11 @@ void NativeMenuGtk::OnMenuMoveCurrent(GtkMenu* menu_widget,
}
if (focus_direction == GTK_MENU_DIR_CHILD && submenu == NULL) {
- menu->GetAncestor()->menu_action_ = MENU_ACTION_NEXT;
- gtk_menu_popdown(menu_widget);
+ GetAncestor()->menu_action_ = MENU_ACTION_NEXT;
+ gtk_menu_popdown(GTK_MENU(menu_widget));
} else if (focus_direction == GTK_MENU_DIR_PARENT && parent == NULL) {
- menu->GetAncestor()->menu_action_ = MENU_ACTION_PREVIOUS;
- gtk_menu_popdown(menu_widget);
+ GetAncestor()->menu_action_ = MENU_ACTION_PREVIOUS;
+ gtk_menu_popdown(GTK_MENU(menu_widget));
}
}
diff --git a/views/controls/menu/native_menu_gtk.h b/views/controls/menu/native_menu_gtk.h
index 812fbad..a8ba37c 100644
--- a/views/controls/menu/native_menu_gtk.h
+++ b/views/controls/menu/native_menu_gtk.h
@@ -9,6 +9,7 @@
#include <vector>
+#include "app/gtk_signal.h"
#include "base/task.h"
#include "views/controls/menu/menu_wrapper.h"
@@ -43,10 +44,9 @@ class NativeMenuGtk : public MenuWrapper {
virtual void RemoveMenuListener(MenuListener* listener);
private:
- static void OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu);
- static void OnMenuMoveCurrent(GtkMenu* widget,
- GtkMenuDirectionType focus_direction,
- NativeMenuGtk* menu);
+ CHROMEGTK_CALLBACK_0(NativeMenuGtk, void, OnMenuHidden);
+ CHROMEGTK_CALLBACK_1(NativeMenuGtk, void, OnMenuMoveCurrent,
+ GtkMenuDirectionType);
void AddSeparatorAt(int index);
GtkWidget* AddMenuItemAt(int index, GtkRadioMenuItem* radio_group,