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

Unified Diff: ash/system/tray/tray_bubble_wrapper.cc

Issue 12510005: Remove close_on_deactivate=false for tray bubbles (2nd) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « ash/system/tray/system_tray.cc ('k') | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tray_bubble_wrapper.cc
diff --git a/ash/system/tray/tray_bubble_wrapper.cc b/ash/system/tray/tray_bubble_wrapper.cc
index 75651c256a5f888107293a3d62c97b78bd306901..c57cc7a009240ab1571250ca66ef94e7fc372a25 100644
--- a/ash/system/tray/tray_bubble_wrapper.cc
+++ b/ash/system/tray/tray_bubble_wrapper.cc
@@ -7,6 +7,9 @@
#include "ash/system/tray/tray_background_view.h"
#include "ash/system/tray/tray_event_filter.h"
#include "ash/wm/window_properties.h"
+#include "base/bind.h"
+#include "base/message_loop.h"
+#include "base/time.h"
#include "ui/views/bubble/tray_bubble_view.h"
#include "ui/views/widget/widget.h"
@@ -17,6 +20,7 @@ TrayBubbleWrapper::TrayBubbleWrapper(TrayBackgroundView* tray,
views::TrayBubbleView* bubble_view)
: tray_(tray),
bubble_view_(bubble_view) {
+ DCHECK(tray_);
bubble_widget_ = views::BubbleDelegateView::CreateBubble(bubble_view_);
bubble_widget_->AddObserver(this);
bubble_widget_->GetNativeView()->
@@ -40,7 +44,14 @@ TrayBubbleWrapper::~TrayBubbleWrapper() {
void TrayBubbleWrapper::OnWidgetDestroying(views::Widget* widget) {
CHECK_EQ(bubble_widget_, widget);
bubble_widget_ = NULL;
- tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_|
+
+ // Do not call HideBubbleWithView directly but post the task to ensure that
+ // HideBubbleWithView is called after the click event on the tray button is
+ // handled. See crbug.com/177075 and crbug.com/169940
+ MessageLoopForUI::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&TrayBackgroundView::HideBubbleWithView,
+ base::Unretained(tray_), base::Unretained(bubble_view_)));
stevenjb 2013/03/06 02:35:26 Is there any possibility that tray_ or bubble_view
Jun Mukai 2013/03/06 04:36:57 Good catch. It's really unlikely but it may happen
}
} // namespace internal
« no previous file with comments | « ash/system/tray/system_tray.cc ('k') | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698