OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 void Initialize(BalloonCollection* balloon_collection) { | 35 void Initialize(BalloonCollection* balloon_collection) { |
36 DCHECK(!balloon_collection_.get()); | 36 DCHECK(!balloon_collection_.get()); |
37 DCHECK(balloon_collection); | 37 DCHECK(balloon_collection); |
38 balloon_collection_.reset(balloon_collection); | 38 balloon_collection_.reset(balloon_collection); |
39 } | 39 } |
40 | 40 |
41 // Adds a notification to be displayed. Virtual for unit test override. | 41 // Adds a notification to be displayed. Virtual for unit test override. |
42 virtual void Add(const Notification& notification, | 42 virtual void Add(const Notification& notification, |
43 Profile* profile); | 43 Profile* profile); |
44 | 44 |
| 45 // Removes a notification. |
| 46 virtual bool Cancel(const Notification& notification); |
| 47 |
45 private: | 48 private: |
46 // Attempts to display notifications from the show_queue if the user | 49 // Attempts to display notifications from the show_queue if the user |
47 // is active. | 50 // is active. |
48 void CheckAndShowNotifications(); | 51 void CheckAndShowNotifications(); |
49 | 52 |
50 // Attempts to display notifications from the show_queue. | 53 // Attempts to display notifications from the show_queue. |
51 void ShowNotifications(); | 54 void ShowNotifications(); |
52 | 55 |
53 // BalloonCollectionObserver implementation. | 56 // BalloonCollectionObserver implementation. |
54 virtual void OnBalloonSpaceChanged(); | 57 virtual void OnBalloonSpaceChanged(); |
55 | 58 |
56 // An owned pointer to the collection of active balloons. | 59 // An owned pointer to the collection of active balloons. |
57 scoped_ptr<BalloonCollection> balloon_collection_; | 60 scoped_ptr<BalloonCollection> balloon_collection_; |
58 | 61 |
59 // A queue of notifications which are waiting to be shown. | 62 // A queue of notifications which are waiting to be shown. |
60 typedef std::deque<QueuedNotification*> NotificationDeque; | 63 typedef std::deque<QueuedNotification*> NotificationDeque; |
61 NotificationDeque show_queue_; | 64 NotificationDeque show_queue_; |
62 | 65 |
63 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | 66 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
64 }; | 67 }; |
65 | 68 |
66 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 69 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
OLD | NEW |