Commit aa4cbc5b authored by Jazz Xu's avatar Jazz Xu Committed by Commit Bot

CrOS GMC: Keep gmc dialog open when unpinning it.

This CL modify the media tray such that the bubble won't close when user
unpins media tray from shelf.

Bug: 1133488
Change-Id: I4ea32592c15b49312c8ab6a14e734069b39c9f5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2439011Reviewed-by: default avatarTim Song <tengs@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Commit-Queue: Jazz Xu <jazzhsu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812244}
parent a6b0aeba
......@@ -306,12 +306,12 @@ void MediaTray::UpdateDisplayState() {
bool should_show =
(MediaNotificationProvider::Get()->HasActiveNotifications() ||
MediaNotificationProvider::Get()->HasFrozenNotifications()) &&
!Shell::Get()->session_controller()->IsScreenLocked() &&
IsPinnedToShelf();
!Shell::Get()->session_controller()->IsScreenLocked();
if (!should_show && bubble_)
CloseBubble();
SetVisiblePreferred(should_show);
SetVisiblePreferred(should_show && IsPinnedToShelf());
}
void MediaTray::OnGlobalMediaControlsPinPrefChanged() {
......
......@@ -205,11 +205,16 @@ TEST_F(MediaTrayTest, PinButtonTest) {
EXPECT_NE(GetBubbleWrapper(), nullptr);
// Tapping the pin button while the media controls dialog is opened
// should have the dialog closed and the media tray hidden.
// should have the media tray hidden.
SimulateTapOnPinButton();
EXPECT_EQ(GetBubbleWrapper(), nullptr);
EXPECT_NE(GetBubbleWrapper(), nullptr);
EXPECT_FALSE(media_tray()->GetVisible());
EXPECT_FALSE(MediaTray::IsPinnedToShelf());
// Tap pin button again should bring back media tray.
SimulateTapOnPinButton();
EXPECT_TRUE(media_tray()->GetVisible());
EXPECT_TRUE(MediaTray::IsPinnedToShelf());
}
TEST_F(MediaTrayTest, PinToShelfDefaultBehavior) {
......
......@@ -136,7 +136,7 @@ void TrayEventFilter::ProcessPressedEvent(const ui::LocatedEvent& event) {
// If the user clicks on the parent tray, don't process the event here,
// let the tray logic handle the event and determine show/hide behavior.
bounds = bubble->GetTray()->GetBoundsInScreen();
if (bounds.Contains(screen_location))
if (bubble->GetTray()->GetVisible() && bounds.Contains(screen_location))
continue;
}
trays.insert(bubble->GetTray());
......
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