Commit 99f238a7 authored by dewittj@chromium.org's avatar dewittj@chromium.org

Remove status icon if there are no more notifications.

This will match the behavior on ChromeOS and ensure that users without
notifications will not be annoyed by the Chrome notifications center
icon in the status tray.

BUG=401215

Review URL: https://codereview.chromium.org/459123002

Cr-Commit-Position: refs/heads/master@{#289128}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289128 0039d316-1c4b-4281-b951-d872f2087c98
parent 65bd25eb
...@@ -276,6 +276,11 @@ void WebNotificationTray::UpdateStatusIcon() { ...@@ -276,6 +276,11 @@ void WebNotificationTray::UpdateStatusIcon() {
tool_tip = l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_TOOLTIP); tool_tip = l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_TOOLTIP);
} }
if (message_center()->GetVisibleNotifications().empty()) {
DestroyStatusIcon();
return;
}
gfx::ImageSkia* icon_image = GetIcon( gfx::ImageSkia* icon_image = GetIcon(
unread_notifications, unread_notifications,
message_center()->IsQuietMode()); message_center()->IsQuietMode());
......
...@@ -249,6 +249,6 @@ IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, MAYBE_StatusIconBehavior) { ...@@ -249,6 +249,6 @@ IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, MAYBE_StatusIconBehavior) {
EXPECT_TRUE(tray->status_icon_ != NULL); EXPECT_TRUE(tray->status_icon_ != NULL);
RemoveNotification("test_id"); RemoveNotification("test_id");
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_TRUE(tray->status_icon_ != NULL); EXPECT_TRUE(tray->status_icon_ == NULL);
} }
} // namespace message_center } // namespace message_center
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