Index: chrome/browser/notifications/message_center_notification_manager.cc |
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc |
index be8bd2ef88fdbbe7e8d4b65da0070182eb80981d..40aff84f31f66dbc631a0abf9a838cf99dd63973 100644 |
--- a/chrome/browser/notifications/message_center_notification_manager.cc |
+++ b/chrome/browser/notifications/message_center_notification_manager.cc |
@@ -25,10 +25,22 @@ |
#include "ui/message_center/message_center_tray.h" |
#include "ui/message_center/notifier_settings.h" |
+namespace { |
+// The first-run balloon will be shown |kFirstRunIdleDelaySeconds| after all |
+// popups go away and the user has notifications in the message center. |
+const int kFirstRunIdleDelaySeconds = 1; |
+} // namespace |
+ |
MessageCenterNotificationManager::MessageCenterNotificationManager( |
- message_center::MessageCenter* message_center) |
+ message_center::MessageCenter* message_center, |
+ PrefService* local_state) |
: message_center_(message_center), |
- settings_controller_(new MessageCenterSettingsController) { |
+ settings_controller_(new MessageCenterSettingsController), |
+ first_run_idle_timeout_( |
+ base::TimeDelta::FromSeconds(kFirstRunIdleDelaySeconds)), |
+ weak_factory_(this) { |
+ first_run_pref_.Init(prefs::kMessageCenterShowedFirstRunBalloon, local_state); |
+ |
message_center_->SetDelegate(this); |
message_center_->AddObserver(this); |
@@ -44,7 +56,6 @@ MessageCenterNotificationManager::~MessageCenterNotificationManager() { |
message_center_->RemoveObserver(this); |
} |
- |
//////////////////////////////////////////////////////////////////////////////// |
// NotificationUIManager |
@@ -274,12 +285,36 @@ void MessageCenterNotificationManager::OnNotificationRemoved( |
profile_notifications_.find(notification_id); |
if (iter != profile_notifications_.end()) |
RemoveProfileNotification(iter->second, by_user); |
+ |
+#if defined(OS_WIN) |
+ CheckFirstRunTimer(); |
+#endif |
} |
void MessageCenterNotificationManager::OnNotificationCenterClosed() { |
// When the center is open it halts all notifications, so we need to listen |
// for events indicating it's been closed. |
CheckAndShowNotifications(); |
+#if defined(OS_WIN) |
+ CheckFirstRunTimer(); |
+#endif |
+} |
+ |
+void MessageCenterNotificationManager::OnNotificationUpdated( |
+ const std::string& notification_id) { |
+#if defined(OS_WIN) |
+ CheckFirstRunTimer(); |
+#endif |
+} |
+ |
+void MessageCenterNotificationManager::SetMessageCenterTrayDelegateForTest( |
+ message_center::MessageCenterTrayDelegate* delegate) { |
+ tray_.reset(delegate); |
+} |
+ |
+void MessageCenterNotificationManager::SetFirstRunTimeoutForTest( |
+ base::TimeDelta timeout) { |
+ first_run_idle_timeout_ = timeout; |
} |
//////////////////////////////////////////////////////////////////////////////// |