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

Side by Side Diff: chrome/browser/notifications/notification_ui_manager.h

Issue 342043: Connect the various pieces for notifications... hook up NotificationUIManager... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: remove stale TODO Created 11 years, 1 month 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_
7
8 #include <deque>
9
10 #include "base/id_map.h"
11 #include "base/scoped_ptr.h"
12 #include "chrome/browser/notifications/balloon.h"
13 #include "chrome/browser/notifications/balloon_collection.h"
14
15 class Notification;
16 class Profile;
17 class QueuedNotification;
18 class SiteInstance;
19
20 // The notification manager manages use of the desktop for notifications.
21 // It maintains a queue of pending notifications when space becomes constrained.
22 class NotificationUIManager :
23 public BalloonCollectionImpl::BalloonSpaceChangeListener {
24 public:
25 NotificationUIManager();
26 virtual ~NotificationUIManager();
27
28 // Creates an initialized UI manager with a new balloon collection
29 // and the listener relationship setup.
30 // Except for unit tests, this is the way to construct the object.
31 static NotificationUIManager* Create();
32
33 // Initializes the UI manager with a balloon collection; this object
34 // takes ownership of the balloon collection.
35 void Initialize(BalloonCollection* balloon_collection) {
36 DCHECK(!balloon_collection_.get());
37 DCHECK(balloon_collection);
38 balloon_collection_.reset(balloon_collection);
39 }
40
41 // Adds a notification to be displayed. Virtual for unit test override.
42 virtual void Add(const Notification& notification,
43 Profile* profile);
44
45 private:
46 // Attempts to display notifications from the show_queue if the user
47 // is active.
48 void CheckAndShowNotifications();
49
50 // Attempts to display notifications from the show_queue.
51 void ShowNotifications();
52
53 // BalloonCollectionObserver implementation.
54 virtual void OnBalloonSpaceChanged();
55
56 // An owned pointer to the collection of active balloons.
57 scoped_ptr<BalloonCollection> balloon_collection_;
58
59 // A queue of notifications which are waiting to be shown.
60 typedef std::deque<QueuedNotification*> NotificationDeque;
61 NotificationDeque show_queue_;
62
63 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager);
64 };
65
66 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698