OLD | NEW |
(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/balloons.h" |
| 13 |
| 14 class Notification; |
| 15 class Profile; |
| 16 class QueuedNotification; |
| 17 class SiteInstance; |
| 18 |
| 19 typedef std::deque<QueuedNotification*> NotificationDeque; |
| 20 |
| 21 // The notification manager is a singleton class which manages |
| 22 // all aspects of using the desktop for notifications. It maintains |
| 23 // a queue of pending notifications when space becomes constrained. |
| 24 class NotificationUIManager : public BalloonCollectionObserver { |
| 25 public: |
| 26 ~NotificationUIManager(); |
| 27 |
| 28 static NotificationUIManager* Create(); |
| 29 |
| 30 void Initialize(BalloonCollectionInterface* balloon_collection); |
| 31 |
| 32 // Adds a notification to be displayed. |
| 33 void Add(const Notification& notification, |
| 34 Profile* profile, SiteInstance* site_instance); |
| 35 |
| 36 // BalloonCollectionObserver implementation. |
| 37 virtual void OnBalloonSpaceChanged(); |
| 38 |
| 39 private: |
| 40 NotificationUIManager() |
| 41 : balloons_observer_(NULL), |
| 42 balloon_collection_(NULL) { |
| 43 } |
| 44 |
| 45 // Attempts to display notifications from the show_queue if the user |
| 46 // is active. |
| 47 void CheckAndShowNotifications(); |
| 48 |
| 49 // Attempts to display notifications from the show_queue. |
| 50 void ShowNotifications(); |
| 51 |
| 52 BalloonCollectionObserver* balloons_observer_; |
| 53 scoped_ptr<BalloonCollectionInterface> balloon_collection_; |
| 54 NotificationDeque show_queue_; |
| 55 |
| 56 IDMap<NotificationObjectProxy> proxy_map_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
| 59 }; |
| 60 |
| 61 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_MANAGER_H_ |
OLD | NEW |