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

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: Fix test failures 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 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;
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698