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

Unified Diff: chrome/browser/notifications/message_center_notification_manager.cc

Issue 17286015: Adds a first-run balloon to the Windows notification center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dimich comments. Created 7 years, 6 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: 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 271158581d195cfafa028ea7be51ce68d1af3e85..5136e5ee295f76369b2c0cc5d04bf299db89a21d 100644
--- a/chrome/browser/notifications/message_center_notification_manager.cc
+++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -25,10 +25,26 @@
#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),
+#if defined(OS_WIN)
+ first_run_idle_timeout_(
+ base::TimeDelta::FromSeconds(kFirstRunIdleDelaySeconds)),
+ weak_factory_(this),
+#endif
settings_controller_(new MessageCenterSettingsController) {
+#if defined(OS_WIN)
+ first_run_pref_.Init(prefs::kMessageCenterShowedFirstRunBalloon, local_state);
+#endif
+
message_center_->SetDelegate(this);
message_center_->AddObserver(this);
message_center_->SetNotifierSettingsProvider(settings_controller_.get());
@@ -45,7 +61,6 @@ MessageCenterNotificationManager::~MessageCenterNotificationManager() {
message_center_->RemoveObserver(this);
}
-
////////////////////////////////////////////////////////////////////////////////
// NotificationUIManager
@@ -270,12 +285,31 @@ 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);
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698