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

Side by Side Diff: chrome/browser/notifications/message_center_notification_manager_win.cc

Issue 1334363002: [Eraser] First pass at removing the notification center panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: peter comments Created 5 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/notifications/message_center_notification_manager.h"
6
7 #include "ui/message_center/message_center_tray.h"
8
9 void MessageCenterNotificationManager::DisplayFirstRunBalloon() {
10 // Store for posterity the fact that we've shown the first-run balloon.
11 DCHECK(tray_.get());
12 first_run_pref_.SetValue(true);
13 tray_->DisplayFirstRunBalloon();
14 }
15
16 void MessageCenterNotificationManager::SetFirstRunTimeoutForTest(
17 base::TimeDelta timeout) {
18 first_run_idle_timeout_ = timeout;
19 }
20
21 bool MessageCenterNotificationManager::FirstRunTimerIsActive() const {
22 return first_run_balloon_timer_.IsRunning();
23 }
24
25 void MessageCenterNotificationManager::CheckFirstRunTimer() {
26 // If there is no tray_, we can't display a balloon here anyway.
27 // Also, we only want to display the first run balloon once, so the pref will
28 // store the flag on disk based on whether we ever showed the balloon.
29 DCHECK(tray_.get());
30 if (first_run_pref_.GetValue())
31 return;
32
33 // If there are popups, the message center is visible, or there are no more
34 // notifications, don't continue the timer since it will be annoying or
35 // useless.
36 if (message_center_->HasPopupNotifications() ||
37 message_center_->IsMessageCenterVisible() ||
38 0 == message_center_->NotificationCount()) {
39 first_run_balloon_timer_.Stop();
40 return;
41 }
42
43 // No need to restart the timer if it's already going.
44 if (first_run_balloon_timer_.IsRunning())
45 return;
46
47 first_run_balloon_timer_.Start(
48 FROM_HERE,
49 first_run_idle_timeout_,
50 base::Bind(&MessageCenterNotificationManager::DisplayFirstRunBalloon,
51 weak_factory_.GetWeakPtr()));
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698