| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Used only for automation/testing. | 83 // Used only for automation/testing. |
| 84 void GetQueuedNotificationsForTesting( | 84 void GetQueuedNotificationsForTesting( |
| 85 std::vector<const Notification*>* notifications); | 85 std::vector<const Notification*>* notifications); |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 explicit NotificationUIManager(PrefService* local_state); | 88 explicit NotificationUIManager(PrefService* local_state); |
| 89 | 89 |
| 90 // content::NotificationObserver override. | 90 // content::NotificationObserver override. |
| 91 virtual void Observe(int type, | 91 virtual void Observe(int type, |
| 92 const content::NotificationSource& source, | 92 const content::NotificationSource& source, |
| 93 const content::NotificationDetails& details); | 93 const content::NotificationDetails& details) OVERRIDE; |
| 94 | 94 |
| 95 // Attempts to display notifications from the show_queue if the user | 95 // Attempts to display notifications from the show_queue if the user |
| 96 // is active. | 96 // is active. |
| 97 void CheckAndShowNotifications(); | 97 void CheckAndShowNotifications(); |
| 98 | 98 |
| 99 // Attempts to display notifications from the show_queue. | 99 // Attempts to display notifications from the show_queue. |
| 100 void ShowNotifications(); | 100 void ShowNotifications(); |
| 101 | 101 |
| 102 // BalloonCollectionObserver implementation. | 102 // BalloonCollectionObserver implementation. |
| 103 virtual void OnBalloonSpaceChanged(); | 103 virtual void OnBalloonSpaceChanged() OVERRIDE; |
| 104 | 104 |
| 105 // Replace an existing notification with this one if applicable; | 105 // Replace an existing notification with this one if applicable; |
| 106 // returns true if the replacement happened. | 106 // returns true if the replacement happened. |
| 107 bool TryReplacement(const Notification& notification); | 107 bool TryReplacement(const Notification& notification); |
| 108 | 108 |
| 109 // Checks the user state to decide if we want to show the notification. | 109 // Checks the user state to decide if we want to show the notification. |
| 110 void CheckUserState(); | 110 void CheckUserState(); |
| 111 | 111 |
| 112 // An owned pointer to the collection of active balloons. | 112 // An owned pointer to the collection of active balloons. |
| 113 scoped_ptr<BalloonCollection> balloon_collection_; | 113 scoped_ptr<BalloonCollection> balloon_collection_; |
| 114 | 114 |
| 115 // A queue of notifications which are waiting to be shown. | 115 // A queue of notifications which are waiting to be shown. |
| 116 typedef std::deque<QueuedNotification*> NotificationDeque; | 116 typedef std::deque<QueuedNotification*> NotificationDeque; |
| 117 NotificationDeque show_queue_; | 117 NotificationDeque show_queue_; |
| 118 | 118 |
| 119 // Registrar for the other kind of notifications (event signaling). | 119 // Registrar for the other kind of notifications (event signaling). |
| 120 content::NotificationRegistrar registrar_; | 120 content::NotificationRegistrar registrar_; |
| 121 | 121 |
| 122 // Prefs listener for the position preference. | 122 // Prefs listener for the position preference. |
| 123 IntegerPrefMember position_pref_; | 123 IntegerPrefMember position_pref_; |
| 124 | 124 |
| 125 // Used by screen-saver and full-screen handling support. | 125 // Used by screen-saver and full-screen handling support. |
| 126 bool is_user_active_; | 126 bool is_user_active_; |
| 127 base::RepeatingTimer<NotificationUIManager> user_state_check_timer_; | 127 base::RepeatingTimer<NotificationUIManager> user_state_check_timer_; |
| 128 | 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | 129 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 132 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
| OLD | NEW |