diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-26 03:07:33 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-26 03:07:33 +0000 |
commit | f41cf2d7a8981288c95a98271d15ba8377e3224b (patch) | |
tree | 5ff0de3a6c886b755108ae9479b569068bcaa044 /ash/system | |
parent | d2a0f20e2c7d583e918ddf69cdb62c0045c0e0a5 (diff) | |
download | chromium_src-f41cf2d7a8981288c95a98271d15ba8377e3224b.zip chromium_src-f41cf2d7a8981288c95a98271d15ba8377e3224b.tar.gz chromium_src-f41cf2d7a8981288c95a98271d15ba8377e3224b.tar.bz2 |
Remove close_on_deactivate=false for tray bubbles.
Actually we want to close those bubbles on deactivation (like, opening
settings page or opening the chat window for a notification). To deal
with the race condition of close-on-deactivate and button action,
a static delay is introduced.
BUG=177075, 169940
TEST=manually checked with goobuntu, see the bugs for the actual steps
Review URL: https://chromiumcodereview.appspot.com/12335044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184572 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r-- | ash/system/tray/system_tray.cc | 1 | ||||
-rw-r--r-- | ash/system/tray/tray_bubble_wrapper.cc | 13 | ||||
-rw-r--r-- | ash/system/web_notification/web_notification_tray.cc | 1 |
3 files changed, 12 insertions, 3 deletions
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 6c5da06..6ee1fa4 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -363,7 +363,6 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items, kTrayPopupMinWidth, kTrayPopupMaxWidth); init_params.can_activate = can_activate; - init_params.close_on_deactivate = false; if (detailed) { // This is the case where a volume control or brightness control bubble // is created. diff --git a/ash/system/tray/tray_bubble_wrapper.cc b/ash/system/tray/tray_bubble_wrapper.cc index 75651c2..c57cc7a 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_))); } } // namespace internal diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index e044cdf..32876d8 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc @@ -60,7 +60,6 @@ class WebNotificationBubbleWrapper { tray->GetAnchorAlignment(); views::TrayBubbleView::InitParams init_params = bubble->GetInitParams(anchor_alignment); - init_params.close_on_deactivate = false; views::View* anchor = tray->tray_container(); if (anchor_alignment == views::TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM) { gfx::Point bounds(anchor->width() / 2, 0); |