summaryrefslogtreecommitdiffstats
path: root/ash/system
diff options
context:
space:
mode:
authorstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-15 08:02:29 +0000
committerstevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-15 08:02:29 +0000
commit728c1db02166910a44b135fa2b6e3b3d33488812 (patch)
tree31e69a41dae8dcede7c981e80b7d0a9194cd8f07 /ash/system
parentee14e7ae88d2aede77d0d151d019512bd44a3e53 (diff)
downloadchromium_src-728c1db02166910a44b135fa2b6e3b3d33488812.zip
chromium_src-728c1db02166910a44b135fa2b6e3b3d33488812.tar.gz
chromium_src-728c1db02166910a44b135fa2b6e3b3d33488812.tar.bz2
Show notification when activating with no connection
This also removes some code that prevented notifications from showing while the detailed view was shown. This behavior is really only desired for SMS, we would actually like to see network/VPN errors. The SMS logic was changed to supress / hide notifications when the detailed view is visible / shown. BUG=172528 For chrome/browser/ui/ash/: TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/12260046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182645 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r--ash/system/chromeos/network/tray_sms.cc2
-rw-r--r--ash/system/tray/system_tray.cc28
-rw-r--r--ash/system/tray/system_tray_unittest.cc6
3 files changed, 9 insertions, 27 deletions
diff --git a/ash/system/chromeos/network/tray_sms.cc b/ash/system/chromeos/network/tray_sms.cc
index 588cd4f..07a0a29 100644
--- a/ash/system/chromeos/network/tray_sms.cc
+++ b/ash/system/chromeos/network/tray_sms.cc
@@ -308,6 +308,8 @@ views::View* TraySms::CreateDetailedView(user::LoginStatus status) {
views::View* TraySms::CreateNotificationView(user::LoginStatus status) {
CHECK(notification_ == NULL);
+ if (detailed_)
+ return NULL;
size_t index;
std::string number, text;
if (GetLatestMessage(&index, &number, &text))
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index f991969..dba58c9 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -395,36 +395,16 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items,
}
void SystemTray::UpdateNotificationBubble() {
- // Only show the notification buble if we have notifications and we are not
- // showing the default bubble.
- if (notification_items_.empty() ||
- HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) {
+ // Only show the notification buble if we have notifications.
+ if (notification_items_.empty()) {
DestroyNotificationBubble();
return;
}
// Destroy the existing bubble before constructing a new one.
notification_bubble_.reset();
SystemTrayBubble* notification_bubble;
- if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DETAILED)) {
- // Skip notifications for any currently displayed detailed item.
- std::vector<SystemTrayItem*> items;
- for (std::vector<SystemTrayItem*>::iterator iter =
- notification_items_.begin();
- iter != notification_items_.end(); ++ iter) {
- if (*iter != detailed_item_)
- items.push_back(*iter);
- }
- if (items.empty()) {
- DestroyNotificationBubble();
- return;
- }
- notification_bubble = new SystemTrayBubble(
- this, items, SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION);
- } else {
- // Show all notifications.
- notification_bubble = new SystemTrayBubble(
- this, notification_items_, SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION);
- }
+ notification_bubble = new SystemTrayBubble(
+ this, notification_items_, SystemTrayBubble::BUBBLE_TYPE_NOTIFICATION);
views::View* anchor;
TrayBubbleView::AnchorType anchor_type;
if (system_bubble_.get()) {
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc
index b5b3ad7..ac693e3 100644
--- a/ash/system/tray/system_tray_unittest.cc
+++ b/ash/system/tray/system_tray_unittest.cc
@@ -232,12 +232,12 @@ TEST_F(SystemTrayTest, SystemTrayNotifications) {
tray->ShowNotificationView(test_item);
ASSERT_TRUE(test_item->notification_view() != NULL);
- // Show the default view, ensure the notification view is destroyed.
+ // Show the default view, notification view should remain.
tray->ShowDefaultView(BUBBLE_CREATE_NEW);
RunAllPendingInMessageLoop();
- ASSERT_TRUE(test_item->notification_view() == NULL);
+ ASSERT_TRUE(test_item->notification_view() != NULL);
- // Show the detailed view, ensure the notificaiton view is created again.
+ // Show the detailed view, ensure the notificaiton view remains.
tray->ShowDetailedView(detailed_item, 0, false, BUBBLE_CREATE_NEW);
RunAllPendingInMessageLoop();
ASSERT_TRUE(detailed_item->detailed_view() != NULL);