OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
(...skipping 12 matching lines...) Expand all Loading... |
23 class Profile; | 23 class Profile; |
24 class QueuedNotification; | 24 class QueuedNotification; |
25 class SiteInstance; | 25 class SiteInstance; |
26 | 26 |
27 // The notification manager manages use of the desktop for notifications. | 27 // The notification manager manages use of the desktop for notifications. |
28 // It maintains a queue of pending notifications when space becomes constrained. | 28 // It maintains a queue of pending notifications when space becomes constrained. |
29 class NotificationUIManager | 29 class NotificationUIManager |
30 : public BalloonCollection::BalloonSpaceChangeListener, | 30 : public BalloonCollection::BalloonSpaceChangeListener, |
31 public NotificationObserver { | 31 public NotificationObserver { |
32 public: | 32 public: |
33 explicit NotificationUIManager(PrefService* local_state); | |
34 virtual ~NotificationUIManager(); | 33 virtual ~NotificationUIManager(); |
35 | 34 |
36 // Creates an initialized UI manager with a new balloon collection | 35 // Creates an initialized UI manager with a new balloon collection |
37 // and the listener relationship setup. | 36 // and the listener relationship setup. |
38 // Except for unit tests, this is the way to construct the object. | 37 // Except for unit tests, this is the way to construct the object. |
39 static NotificationUIManager* Create(PrefService* local_state); | 38 static NotificationUIManager* Create(PrefService* local_state); |
40 | 39 |
41 // Registers preferences. | 40 // Registers preferences. |
42 static void RegisterPrefs(PrefService* prefs); | 41 static void RegisterPrefs(PrefService* prefs); |
43 | 42 |
(...skipping 24 matching lines...) Expand all Loading... |
68 } | 67 } |
69 | 68 |
70 // Gets the preference indicating where notifications should be placed. | 69 // Gets the preference indicating where notifications should be placed. |
71 BalloonCollection::PositionPreference GetPositionPreference(); | 70 BalloonCollection::PositionPreference GetPositionPreference(); |
72 | 71 |
73 // Sets the preference that indicates where notifications should | 72 // Sets the preference that indicates where notifications should |
74 // be placed on the screen. | 73 // be placed on the screen. |
75 void SetPositionPreference(BalloonCollection::PositionPreference preference); | 74 void SetPositionPreference(BalloonCollection::PositionPreference preference); |
76 | 75 |
77 private: | 76 private: |
| 77 explicit NotificationUIManager(PrefService* local_state); |
| 78 |
78 // NotificationObserver override. | 79 // NotificationObserver override. |
79 virtual void Observe(NotificationType type, | 80 virtual void Observe(NotificationType type, |
80 const NotificationSource& source, | 81 const NotificationSource& source, |
81 const NotificationDetails& details); | 82 const NotificationDetails& details); |
82 | 83 |
83 // Attempts to display notifications from the show_queue if the user | 84 // Attempts to display notifications from the show_queue if the user |
84 // is active. | 85 // is active. |
85 void CheckAndShowNotifications(); | 86 void CheckAndShowNotifications(); |
86 | 87 |
87 // Attempts to display notifications from the show_queue. | 88 // Attempts to display notifications from the show_queue. |
(...skipping 23 matching lines...) Expand all Loading... |
111 IntegerPrefMember position_pref_; | 112 IntegerPrefMember position_pref_; |
112 | 113 |
113 // Used by screen-saver and full-screen handling support. | 114 // Used by screen-saver and full-screen handling support. |
114 bool is_user_active_; | 115 bool is_user_active_; |
115 base::RepeatingTimer<NotificationUIManager> user_state_check_timer_; | 116 base::RepeatingTimer<NotificationUIManager> user_state_check_timer_; |
116 | 117 |
117 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | 118 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
118 }; | 119 }; |
119 | 120 |
120 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 121 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
OLD | NEW |