Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5330)

Unified Diff: ash/system/tray/system_tray.cc

Issue 10332152: Add TraySms for SMS messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only observe with --aura-notify Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/tray/system_tray.cc
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index e0362d57e60cfc0db3328e544eb3cb1a1a91bbc0..2d544bb0b70af23bb77d163e52dab0852ac67579 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -14,6 +14,7 @@
#include "ash/system/drive/tray_drive.h"
#include "ash/system/ime/tray_ime.h"
#include "ash/system/network/tray_network.h"
+#include "ash/system/network/tray_sms.h"
#include "ash/system/power/power_status_observer.h"
#include "ash/system/power/power_supply_status.h"
#include "ash/system/power/tray_power.h"
@@ -172,6 +173,7 @@ void SystemTray::CreateItems() {
internal::TrayDate* tray_date = new internal::TrayDate();
internal::TrayPower* tray_power = new internal::TrayPower();
internal::TrayNetwork* tray_network = new internal::TrayNetwork;
+ internal::TraySms* tray_sms = new internal::TraySms();
internal::TrayUser* tray_user = new internal::TrayUser;
internal::TrayAccessibility* tray_accessibility =
new internal::TrayAccessibility;
@@ -197,6 +199,7 @@ void SystemTray::CreateItems() {
AddTrayItem(tray_power);
AddTrayItem(tray_network);
AddTrayItem(tray_bluetooth);
+ AddTrayItem(tray_sms);
AddTrayItem(tray_drive);
AddTrayItem(tray_ime);
AddTrayItem(tray_volume);
@@ -263,6 +266,19 @@ void SystemTray::ShowDetailedView(SystemTrayItem* item,
bubble_->StartAutoCloseTimer(close_delay);
}
+void SystemTray::SetDetailedViewCloseDelay(int close_delay) {
+ if (bubble_.get() &&
+ bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DETAILED)
+ bubble_->StartAutoCloseTimer(close_delay);
+}
+
+void SystemTray::HideDetailedView(SystemTrayItem* item) {
+ if (item == detailed_item_) {
sadrul 2012/05/15 15:10:50 I am thinking this should be a DCHECK.
stevenjb 2012/05/15 16:55:20 I would rather keep this safe in case a class call
+ bubble_.reset();
+ UpdateNotificationBubble();
+ }
+}
+
void SystemTray::ShowNotificationView(SystemTrayItem* item) {
if (std::find(notification_items_.begin(), notification_items_.end(), item)
!= notification_items_.end())
@@ -277,13 +293,9 @@ void SystemTray::HideNotificationView(SystemTrayItem* item) {
if (found_iter == notification_items_.end())
return;
notification_items_.erase(found_iter);
- UpdateNotificationBubble();
-}
-
-void SystemTray::SetDetailedViewCloseDelay(int close_delay) {
- if (bubble_.get() &&
- bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DETAILED)
- bubble_->StartAutoCloseTimer(close_delay);
+ // Only update the notification bubble if visible (i.e. don't create one).
+ if (notification_bubble_.get())
+ UpdateNotificationBubble();
}
void SystemTray::UpdateAfterLoginStatusChange(user::LoginStatus login_status) {
@@ -342,6 +354,16 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items,
SystemTrayBubble::BUBBLE_TYPE_DETAILED :
SystemTrayBubble::BUBBLE_TYPE_DEFAULT;
bubble_.reset(new SystemTrayBubble(this, items, bubble_type));
+
+ if (detailed && items.size() > 0)
+ detailed_item_ = items[0];
+ else
+ detailed_item_ = NULL;
+
+ // Destroy the notification bubble here so that it doesn't get rebuilt
+ // while we add items to the main bubble_ (e.g. in HideNotificationView).
+ notification_bubble_.reset();
+
ash::SystemTrayDelegate* delegate =
ash::Shell::GetInstance()->tray_delegate();
views::View* anchor = tray_container_;

Powered by Google App Engine
This is Rietveld 408576698