summaryrefslogtreecommitdiffstats
path: root/ash/system
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 05:27:30 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-07 05:27:30 +0000
commite652df3e915ab9720480158f261a285e4a696a77 (patch)
treecb6fef0338037e4f918dd8395e287fff86258c67 /ash/system
parent8405db533878bac39d622c421e8c1baa9d21c0fe (diff)
downloadchromium_src-e652df3e915ab9720480158f261a285e4a696a77.zip
chromium_src-e652df3e915ab9720480158f261a285e4a696a77.tar.gz
chromium_src-e652df3e915ab9720480158f261a285e4a696a77.tar.bz2
Revert 186612
> Remove close_on_deactivate=false for tray bubbles (2nd) > > 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. > > The first attempt (r184572) has been reverted due to a crash bug. > It seems that the crash happens because of missing cleanup of system > notification bubbles. > > BUG=179992, 177075 > TEST=on goobuntu, open the systme tray, wait for the power notifications, then click 'settings' and see no crash. > > > Review URL: https://chromiumcodereview.appspot.com/12510005 TBR=mukai@chromium.org Review URL: https://codereview.chromium.org/12580003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r--ash/system/tray/system_tray.cc3
-rw-r--r--ash/system/tray/tray_background_view.h2
-rw-r--r--ash/system/tray/tray_bubble_wrapper.cc16
-rw-r--r--ash/system/tray/tray_bubble_wrapper.h14
-rw-r--r--ash/system/web_notification/web_notification_tray.cc1
5 files changed, 7 insertions, 29 deletions
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 3623c16..0b17757 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -364,6 +364,7 @@ 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.
@@ -476,8 +477,6 @@ void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) {
} else if (notification_bubble_.get() &&
bubble_view == notification_bubble_->bubble_view()) {
DestroyNotificationBubble();
- } else {
- UpdateNotificationBubble();
}
}
diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h
index 17aa5a9..8b136655 100644
--- a/ash/system/tray/tray_background_view.h
+++ b/ash/system/tray/tray_background_view.h
@@ -87,7 +87,7 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
virtual string16 GetAccessibleNameForTray() = 0;
// Hides the bubble associated with |bubble_view|. Called when the widget
- // is closed. |bubble_view| may be already destroyed.
+ // is closed.
virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0;
// Called by the bubble wrapper when a click event occurs outside the bubble.
diff --git a/ash/system/tray/tray_bubble_wrapper.cc b/ash/system/tray/tray_bubble_wrapper.cc
index 70980ea..75651c2 100644
--- a/ash/system/tray/tray_bubble_wrapper.cc
+++ b/ash/system/tray/tray_bubble_wrapper.cc
@@ -7,9 +7,6 @@
#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"
@@ -20,7 +17,6 @@ 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()->
@@ -44,17 +40,7 @@ TrayBubbleWrapper::~TrayBubbleWrapper() {
void TrayBubbleWrapper::OnWidgetDestroying(views::Widget* widget) {
CHECK_EQ(bubble_widget_, widget);
bubble_widget_ = NULL;
-
- // 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(&TrayBubbleWrapper::HideBubbleWithView, AsWeakPtr()));
-}
-
-void TrayBubbleWrapper::HideBubbleWithView() {
- tray_->HideBubbleWithView(bubble_view_);
+ tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_|
}
} // namespace internal
diff --git a/ash/system/tray/tray_bubble_wrapper.h b/ash/system/tray/tray_bubble_wrapper.h
index 562b196..baa5416 100644
--- a/ash/system/tray/tray_bubble_wrapper.h
+++ b/ash/system/tray/tray_bubble_wrapper.h
@@ -7,7 +7,6 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
#include "ui/views/widget/widget_observer.h"
namespace views {
@@ -21,8 +20,8 @@ class TrayBackgroundView;
class TrayEventFilter;
// Creates and manages the Widget and EventFilter components of a bubble.
-class TrayBubbleWrapper : public views::WidgetObserver,
- public base::SupportsWeakPtr<TrayBubbleWrapper> {
+
+class TrayBubbleWrapper : public views::WidgetObserver {
public:
TrayBubbleWrapper(TrayBackgroundView* tray,
views::TrayBubbleView* bubble_view);
@@ -37,15 +36,8 @@ class TrayBubbleWrapper : public views::WidgetObserver,
const views::Widget* bubble_widget() const { return bubble_widget_; }
private:
- void HideBubbleWithView();
-
- // unowned. |tray_| owns this and it should outlive.
TrayBackgroundView* tray_;
-
- // unowned.
- views::TrayBubbleView* bubble_view_;
-
- // unowned.
+ views::TrayBubbleView* bubble_view_; // unowned
views::Widget* bubble_widget_;
DISALLOW_COPY_AND_ASSIGN(TrayBubbleWrapper);
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index 2e05fa4..cfc1e1c 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -61,6 +61,7 @@ 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);