diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-26 17:36:57 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-26 17:36:57 +0000 |
commit | 532ecbb769085fa7000b9013dc831c71644e116a (patch) | |
tree | 5a9a69eaec30a2fe6ebf9731008ea45dfb6893e0 | |
parent | a8f18aebeb708553cb1cea888213c77837102ae6 (diff) | |
download | chromium_src-532ecbb769085fa7000b9013dc831c71644e116a.zip chromium_src-532ecbb769085fa7000b9013dc831c71644e116a.tar.gz chromium_src-532ecbb769085fa7000b9013dc831c71644e116a.tar.bz2 |
estade:- This revert is to fix interactive ui test failures which have been broken since Wednesday. Your CL
is not at fault though. 42498 seems to be the culprit. I had to revert your CL as it leads to conflicts while
reverting 42498
Revert 42703 - 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
TBR=estade@chromium.org
Review URL: http://codereview.chromium.org/1423002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42778 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/browser_actions_container.cc | 18 | ||||
-rw-r--r-- | chrome/browser/views/browser_actions_container.h | 14 | ||||
-rw-r--r-- | views/controls/menu/native_menu_gtk.cc | 27 | ||||
-rw-r--r-- | views/controls/menu/native_menu_gtk.h | 8 |
4 files changed, 23 insertions, 44 deletions
diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index 7ccaee8..b23cb76 100644 --- a/chrome/browser/views/browser_actions_container.cc +++ b/chrome/browser/views/browser_actions_container.cc @@ -125,13 +125,7 @@ BrowserActionButton::BrowserActionButton(Extension* extension, Extension::kBrowserActionIconMaxSize)); } -void BrowserActionButton::Destroy() { - if (showing_context_menu_) { - context_menu_menu_->CancelMenu(); - MessageLoop::current()->DeleteSoon(FROM_HERE, this); - } else { - delete this; - } +BrowserActionButton::~BrowserActionButton() { } gfx::Insets BrowserActionButton::GetInsets() const { @@ -241,8 +235,6 @@ bool BrowserActionButton::OnMousePressed(const views::MouseEvent& e) { context_menu_menu_->RunContextMenuAt(point); SetButtonNotPushed(); - showing_context_menu_ = false; - return false; } else if (IsPopup()) { return MenuButton::OnMousePressed(e); @@ -284,9 +276,6 @@ void BrowserActionButton::SetButtonNotPushed() { menu_visible_ = false; } -BrowserActionButton::~BrowserActionButton() { -} - //////////////////////////////////////////////////////////////////////////////// // BrowserActionView @@ -300,11 +289,6 @@ BrowserActionView::BrowserActionView(Extension* extension, button_->UpdateState(); } -BrowserActionView::~BrowserActionView() { - RemoveChildView(button_); - button_->Destroy(); -} - gfx::Canvas* BrowserActionView::GetIconWithBadge() { int tab_id = panel_->GetCurrentTabId(); diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h index de6048c..45cfaf9 100644 --- a/chrome/browser/views/browser_actions_container.h +++ b/chrome/browser/views/browser_actions_container.h @@ -50,9 +50,7 @@ class BrowserActionButton : public views::MenuButton, public NotificationObserver { public: BrowserActionButton(Extension* extension, BrowserActionsContainer* panel); - - // Call this instead of delete. - void Destroy(); + ~BrowserActionButton(); ExtensionAction* browser_action() const { return browser_action_; } Extension* extension() { return extension_; } @@ -96,12 +94,10 @@ class BrowserActionButton : public views::MenuButton, // Notifications when to set button state to pushed/not pushed (for when the // popup/context menu is hidden or shown by the container). - void SetButtonPushed(); - void SetButtonNotPushed(); + virtual void SetButtonPushed(); + virtual void SetButtonNotPushed(); private: - virtual ~BrowserActionButton(); - // The browser action this view represents. The ExtensionAction is not owned // by this class. ExtensionAction* browser_action_; @@ -128,8 +124,6 @@ class BrowserActionButton : public views::MenuButton, NotificationRegistrar registrar_; - friend class DeleteTask<BrowserActionButton>; - DISALLOW_COPY_AND_ASSIGN(BrowserActionButton); }; @@ -142,8 +136,6 @@ class BrowserActionButton : public views::MenuButton, class BrowserActionView : public views::View { public: BrowserActionView(Extension* extension, BrowserActionsContainer* panel); - virtual ~BrowserActionView(); - BrowserActionButton* button() { return button_; } // Allocates a canvas object on the heap and draws into it the icon for the diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc index a10e130..012d2a8 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(OnMenuHiddenThunk), this); + g_signal_connect(menu_, "hide", G_CALLBACK(OnMenuHidden), this); gint move_handle_id = - g_signal_connect(menu_, "move-current", - G_CALLBACK(OnMenuMoveCurrentThunk), this); + g_signal_connect(menu_, "move-current", G_CALLBACK(OnMenuMoveCurrent), + 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() { - gtk_widget_hide(menu_); + NOTIMPLEMENTED(); } void NativeMenuGtk::Rebuild() { @@ -208,8 +208,9 @@ void NativeMenuGtk::RemoveMenuListener(MenuListener* listener) { //////////////////////////////////////////////////////////////////////////////// // NativeMenuGtk, private: -void NativeMenuGtk::OnMenuHidden(GtkWidget* widget) { - if (!menu_shown_) { +// static +void NativeMenuGtk::OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu) { + if (!menu->menu_shown_) { // This indicates we don't have a menu open, and should never happen. NOTREACHED(); return; @@ -218,8 +219,10 @@ void NativeMenuGtk::OnMenuHidden(GtkWidget* widget) { MessageLoop::current()->Quit(); } -void NativeMenuGtk::OnMenuMoveCurrent(GtkWidget* menu_widget, - GtkMenuDirectionType focus_direction) { +// static +void NativeMenuGtk::OnMenuMoveCurrent(GtkMenu* menu_widget, + GtkMenuDirectionType focus_direction, + NativeMenuGtk* menu) { GtkWidget* parent = GTK_MENU_SHELL(menu_widget)->parent_menu_shell; GtkWidget* menu_item = GTK_MENU_SHELL(menu_widget)->active_menu_item; GtkWidget* submenu = NULL; @@ -228,11 +231,11 @@ void NativeMenuGtk::OnMenuMoveCurrent(GtkWidget* menu_widget, } if (focus_direction == GTK_MENU_DIR_CHILD && submenu == NULL) { - GetAncestor()->menu_action_ = MENU_ACTION_NEXT; - gtk_menu_popdown(GTK_MENU(menu_widget)); + menu->GetAncestor()->menu_action_ = MENU_ACTION_NEXT; + gtk_menu_popdown(menu_widget); } else if (focus_direction == GTK_MENU_DIR_PARENT && parent == NULL) { - GetAncestor()->menu_action_ = MENU_ACTION_PREVIOUS; - gtk_menu_popdown(GTK_MENU(menu_widget)); + menu->GetAncestor()->menu_action_ = MENU_ACTION_PREVIOUS; + gtk_menu_popdown(menu_widget); } } diff --git a/views/controls/menu/native_menu_gtk.h b/views/controls/menu/native_menu_gtk.h index a8ba37c..812fbad 100644 --- a/views/controls/menu/native_menu_gtk.h +++ b/views/controls/menu/native_menu_gtk.h @@ -9,7 +9,6 @@ #include <vector> -#include "app/gtk_signal.h" #include "base/task.h" #include "views/controls/menu/menu_wrapper.h" @@ -44,9 +43,10 @@ class NativeMenuGtk : public MenuWrapper { virtual void RemoveMenuListener(MenuListener* listener); private: - CHROMEGTK_CALLBACK_0(NativeMenuGtk, void, OnMenuHidden); - CHROMEGTK_CALLBACK_1(NativeMenuGtk, void, OnMenuMoveCurrent, - GtkMenuDirectionType); + static void OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu); + static void OnMenuMoveCurrent(GtkMenu* widget, + GtkMenuDirectionType focus_direction, + NativeMenuGtk* menu); void AddSeparatorAt(int index); GtkWidget* AddMenuItemAt(int index, GtkRadioMenuItem* radio_group, |