Chromium Code Reviews| 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 manages use of the desktop for notifications. | |
| 22 // It maintains a queue of pending notifications when space becomes constrained. | |
| 23 class NotificationUIManager : public BalloonSpaceChangeListener { | |
| 24 public: | |
| 25 ~NotificationUIManager(); | |
| 26 | |
| 27 // Creates a new UI manager without a balloon collection. This | |
| 28 // is useful for unit tests. | |
| 29 static NotificationUIManager* Create(); | |
| 30 | |
| 31 // Initializes the UI manager with a balloon collection; this object | |
| 32 // takes ownership of the balloon collection. | |
| 33 void Initialize(BalloonCollectionInterface* balloon_collection); | |
| 34 | |
| 35 // Adds a notification to be displayed. | |
|
michaeln
2009/10/10 19:10:51
From the callsite, it looks like ownership of site
| |
| 36 void Add(const Notification& notification, | |
| 37 Profile* profile, SiteInstance* site_instance) { | |
| 38 // TODO(johnnyg): Implementation of notification UI manager coming soon. | |
| 39 } | |
| 40 | |
| 41 private: | |
| 42 NotificationUIManager() | |
| 43 : balloon_collection_(NULL) { | |
| 44 } | |
| 45 | |
| 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<BalloonCollectionInterface> balloon_collection_; | |
| 58 | |
| 59 // A queue of notifications which are waiting to be shown. | |
| 60 NotificationDeque show_queue_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | |
| 63 }; | |
| 64 | |
| 65 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | |
| OLD | NEW |