Commit 7e37ce70 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Fix message center crashes

This change fixes a number of crashes caused by the message center
widget being destroyed without it's animations being cleaned up
properly.

Change-Id: If70b46d530867721785cd208db937207c6dcc865
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1877256
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709266}
parent d3d583a4
...@@ -55,10 +55,6 @@ UnifiedMessageCenterBubble::UnifiedMessageCenterBubble(UnifiedSystemTray* tray) ...@@ -55,10 +55,6 @@ UnifiedMessageCenterBubble::UnifiedMessageCenterBubble(UnifiedSystemTray* tray)
tray->bubble()->unified_view()->AddObserver(this); tray->bubble()->unified_view()->AddObserver(this);
UpdatePosition(); UpdatePosition();
if (!message_center_view_->GetVisible()) {
bubble_widget_->Hide();
}
} }
UnifiedMessageCenterBubble::~UnifiedMessageCenterBubble() { UnifiedMessageCenterBubble::~UnifiedMessageCenterBubble() {
...@@ -132,15 +128,6 @@ views::Widget* UnifiedMessageCenterBubble::GetBubbleWidget() const { ...@@ -132,15 +128,6 @@ views::Widget* UnifiedMessageCenterBubble::GetBubbleWidget() const {
return bubble_widget_; return bubble_widget_;
} }
void UnifiedMessageCenterBubble::OnViewVisibilityChanged(
views::View* observed_view,
views::View* starting_view) {
if (message_center_view_->GetVisible())
bubble_widget_->Show();
else
bubble_widget_->Hide();
}
void UnifiedMessageCenterBubble::OnViewPreferredSizeChanged( void UnifiedMessageCenterBubble::OnViewPreferredSizeChanged(
views::View* observed_view) { views::View* observed_view) {
UpdatePosition(); UpdatePosition();
......
...@@ -59,8 +59,6 @@ class ASH_EXPORT UnifiedMessageCenterBubble : public TrayBubbleBase, ...@@ -59,8 +59,6 @@ class ASH_EXPORT UnifiedMessageCenterBubble : public TrayBubbleBase,
views::Widget* GetBubbleWidget() const override; views::Widget* GetBubbleWidget() const override;
// views::ViewObserver: // views::ViewObserver:
void OnViewVisibilityChanged(views::View* observed_view,
views::View* starting_view) override;
void OnViewPreferredSizeChanged(views::View* observed_view) override; void OnViewPreferredSizeChanged(views::View* observed_view) override;
// views::WidgetObserver: // views::WidgetObserver:
......
...@@ -129,20 +129,6 @@ class UnifiedMessageCenterBubbleTest : public AshTestBase { ...@@ -129,20 +129,6 @@ class UnifiedMessageCenterBubbleTest : public AshTestBase {
DISALLOW_COPY_AND_ASSIGN(UnifiedMessageCenterBubbleTest); DISALLOW_COPY_AND_ASSIGN(UnifiedMessageCenterBubbleTest);
}; };
TEST_F(UnifiedMessageCenterBubbleTest, VisibileOnlyWithNotifications) {
EnableMessageCenterRefactor();
GetPrimaryUnifiedSystemTray()->ShowBubble(true);
// UnifiedMessageCenterBubble should not be visible when there are no
// notifications.
EXPECT_FALSE(GetMessageCenterBubble()->GetBubbleWidget()->IsVisible());
AddNotification();
// UnifiedMessageCenterBubble should become visible after a notification is
// added.
EXPECT_TRUE(GetMessageCenterBubble()->GetBubbleWidget()->IsVisible());
}
TEST_F(UnifiedMessageCenterBubbleTest, PositionedAboveSystemTray) { TEST_F(UnifiedMessageCenterBubbleTest, PositionedAboveSystemTray) {
const int total_notifications = 5; const int total_notifications = 5;
EnableMessageCenterRefactor(); EnableMessageCenterRefactor();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment