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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/timer.h" |
14 #include "chrome/browser/notifications/balloon.h" | 15 #include "chrome/browser/notifications/balloon.h" |
15 #include "chrome/browser/notifications/balloon_collection.h" | 16 #include "chrome/browser/notifications/balloon_collection.h" |
16 #include "chrome/browser/prefs/pref_member.h" | 17 #include "chrome/browser/prefs/pref_member.h" |
17 #include "chrome/common/notification_observer.h" | 18 #include "chrome/common/notification_observer.h" |
18 #include "chrome/common/notification_registrar.h" | 19 #include "chrome/common/notification_registrar.h" |
19 | 20 |
20 class Notification; | 21 class Notification; |
21 class PrefService; | 22 class PrefService; |
22 class Profile; | 23 class Profile; |
23 class QueuedNotification; | 24 class QueuedNotification; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Attempts to display notifications from the show_queue. | 87 // Attempts to display notifications from the show_queue. |
87 void ShowNotifications(); | 88 void ShowNotifications(); |
88 | 89 |
89 // BalloonCollectionObserver implementation. | 90 // BalloonCollectionObserver implementation. |
90 virtual void OnBalloonSpaceChanged(); | 91 virtual void OnBalloonSpaceChanged(); |
91 | 92 |
92 // Replace an existing notification with this one if applicable; | 93 // Replace an existing notification with this one if applicable; |
93 // returns true if the replacement happened. | 94 // returns true if the replacement happened. |
94 bool TryReplacement(const Notification& notification); | 95 bool TryReplacement(const Notification& notification); |
95 | 96 |
| 97 // Checks the user state to decide if we want to show the notification. |
| 98 void CheckUserState(); |
| 99 |
96 // An owned pointer to the collection of active balloons. | 100 // An owned pointer to the collection of active balloons. |
97 scoped_ptr<BalloonCollection> balloon_collection_; | 101 scoped_ptr<BalloonCollection> balloon_collection_; |
98 | 102 |
99 // A queue of notifications which are waiting to be shown. | 103 // A queue of notifications which are waiting to be shown. |
100 typedef std::deque<QueuedNotification*> NotificationDeque; | 104 typedef std::deque<QueuedNotification*> NotificationDeque; |
101 NotificationDeque show_queue_; | 105 NotificationDeque show_queue_; |
102 | 106 |
103 // Registrar for the other kind of notifications (event signaling). | 107 // Registrar for the other kind of notifications (event signaling). |
104 NotificationRegistrar registrar_; | 108 NotificationRegistrar registrar_; |
105 | 109 |
106 // Prefs listener for the position preference. | 110 // Prefs listener for the position preference. |
107 IntegerPrefMember position_pref_; | 111 IntegerPrefMember position_pref_; |
108 | 112 |
| 113 // Used by screen-saver and full-screen handling support. |
| 114 bool is_user_active_; |
| 115 base::RepeatingTimer<NotificationUIManager> user_state_check_timer_; |
| 116 |
109 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | 117 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
110 }; | 118 }; |
111 | 119 |
112 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 120 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
OLD | NEW |