Chromium Code Reviews| Index: chrome/browser/ui/views/browser_actions_container.cc |
| diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc |
| index ef3dd6e7008693358b448560840b4d8e19296beb..50fb3ce85a1a703a7ff28bab137579ee61533637 100644 |
| --- a/chrome/browser/ui/views/browser_actions_container.cc |
| +++ b/chrome/browser/ui/views/browser_actions_container.cc |
| @@ -813,8 +813,12 @@ void BrowserActionsContainer::InspectPopup(ExtensionAction* action) { |
| } |
| void BrowserActionsContainer::OnWidgetClosing(views::Widget* widget) { |
| - DCHECK_EQ(popup_->GetWidget(), widget); |
| - popup_->GetWidget()->RemoveObserver(this); |
| + // Always remove this as an observer of a closing popup. |
| + widget->RemoveObserver(this); |
| + // If a new popup has been opened before this gets called, popup_ will |
| + // point to the new popup, so just return. |
| + if (popup_->GetWidget() != widget) |
| + return; |
| popup_ = NULL; |
| // |popup_button_| is NULL if the extension has been removed. |
| if (popup_button_) { |
| @@ -834,8 +838,12 @@ void BrowserActionsContainer::MoveBrowserAction(const std::string& extension_id, |
| } |
| void BrowserActionsContainer::HidePopup() { |
| - if (popup_) { |
| + if (popup_) |
| popup_->GetWidget()->Close(); |
| + if (popup_button_) { |
| + // Set the popup button to not pused here, since we might change popup_ |
|
msw
2012/02/29 19:21:36
spelling nit: pushed
|
| + // before OnWidgetClosing() gets called. |
| + popup_button_->SetButtonNotPushed(); |
| // NULL out popup_button_ in case it's being deleted. |
| popup_button_ = NULL; |
| } |