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

Side by Side Diff: chrome/browser/notifications/message_center_notification_manager_win.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: Moar fixes. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 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 "chrome/common/pref_names.h"
8 #include "ui/message_center/message_center_tray.h"
9
10 void MessageCenterNotificationManager::DisplayFirstRunBalloon() {
11 // Store for posterity the fact that we've shown the first-run balloon.
12 DCHECK(tray_.get());
13 first_run_pref_.SetValue(true);
14 tray_->DisplayFirstRunBalloon();
15 }
16
17 void MessageCenterNotificationManager::CheckFirstRunTimer() {
18 // If there is no tray_, we can't display a balloon here anyway.
19 // Also, we only want to display the first run balloon once, so the pref will
20 // store the flag on disk based on whether we ever showed the balloon.
21 DCHECK(tray_.get());
22 if (first_run_pref_.GetValue())
23 return;
24
25 // If there are popups, the message center is visible, or there are no more
26 // notifications, don't continue the timer since it will be annoying or
27 // useless.
28 if (message_center_->HasPopupNotifications() ||
29 message_center_->IsMessageCenterVisible() ||
30 0 == message_center_->NotificationCount()) {
31 first_run_balloon_timer_.Stop();
32 return;
33 }
34
35 // No need to restart the timer if it's already going.
36 if (first_run_balloon_timer_.IsRunning())
37 return;
38
39 first_run_balloon_timer_.Start(
40 FROM_HERE,
41 first_run_idle_timeout_,
42 base::Bind(&MessageCenterNotificationManager::DisplayFirstRunBalloon,
43 weak_factory_.GetWeakPtr()));
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698