| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_MESSAGE_CENTER_MESSAGE_CENTER_IMPL_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_IMPL_H_ |
| 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_IMPL_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 class MESSAGE_CENTER_EXPORT PopupTimersController | 81 class MESSAGE_CENTER_EXPORT PopupTimersController |
| 82 : public base::SupportsWeakPtr<PopupTimersController>, | 82 : public base::SupportsWeakPtr<PopupTimersController>, |
| 83 public MessageCenterObserver { | 83 public MessageCenterObserver { |
| 84 public: | 84 public: |
| 85 explicit PopupTimersController(MessageCenter* message_center); | 85 explicit PopupTimersController(MessageCenter* message_center); |
| 86 virtual ~PopupTimersController(); | 86 virtual ~PopupTimersController(); |
| 87 | 87 |
| 88 // MessageCenterObserver implementation. | 88 // MessageCenterObserver implementation. |
| 89 virtual void OnNotificationDisplayed( | 89 virtual void OnNotificationDisplayed( |
| 90 const std::string& id, | 90 const std::string& id, |
| 91 const DisplaySource source) OVERRIDE; | 91 const DisplaySource source) override; |
| 92 virtual void OnNotificationUpdated(const std::string& id) OVERRIDE; | 92 virtual void OnNotificationUpdated(const std::string& id) override; |
| 93 virtual void OnNotificationRemoved(const std::string& id, bool by_user) | 93 virtual void OnNotificationRemoved(const std::string& id, bool by_user) |
| 94 OVERRIDE; | 94 override; |
| 95 | 95 |
| 96 // Callback for each timer when its time is up. | 96 // Callback for each timer when its time is up. |
| 97 virtual void TimerFinished(const std::string& id); | 97 virtual void TimerFinished(const std::string& id); |
| 98 | 98 |
| 99 // Pauses all running timers. | 99 // Pauses all running timers. |
| 100 void PauseAll(); | 100 void PauseAll(); |
| 101 | 101 |
| 102 // Continues all managed timers. | 102 // Continues all managed timers. |
| 103 void StartAll(); | 103 void StartAll(); |
| 104 | 104 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 // The default implementation of MessageCenter. | 139 // The default implementation of MessageCenter. |
| 140 class MessageCenterImpl : public MessageCenter, | 140 class MessageCenterImpl : public MessageCenter, |
| 141 public NotificationBlocker::Observer, | 141 public NotificationBlocker::Observer, |
| 142 public message_center::NotifierSettingsObserver { | 142 public message_center::NotifierSettingsObserver { |
| 143 public: | 143 public: |
| 144 MessageCenterImpl(); | 144 MessageCenterImpl(); |
| 145 virtual ~MessageCenterImpl(); | 145 virtual ~MessageCenterImpl(); |
| 146 | 146 |
| 147 // MessageCenter overrides: | 147 // MessageCenter overrides: |
| 148 virtual void AddObserver(MessageCenterObserver* observer) OVERRIDE; | 148 virtual void AddObserver(MessageCenterObserver* observer) override; |
| 149 virtual void RemoveObserver(MessageCenterObserver* observer) OVERRIDE; | 149 virtual void RemoveObserver(MessageCenterObserver* observer) override; |
| 150 virtual void AddNotificationBlocker(NotificationBlocker* blocker) OVERRIDE; | 150 virtual void AddNotificationBlocker(NotificationBlocker* blocker) override; |
| 151 virtual void RemoveNotificationBlocker(NotificationBlocker* blocker) OVERRIDE; | 151 virtual void RemoveNotificationBlocker(NotificationBlocker* blocker) override; |
| 152 virtual void SetVisibility(Visibility visible) OVERRIDE; | 152 virtual void SetVisibility(Visibility visible) override; |
| 153 virtual bool IsMessageCenterVisible() const OVERRIDE; | 153 virtual bool IsMessageCenterVisible() const override; |
| 154 virtual size_t NotificationCount() const OVERRIDE; | 154 virtual size_t NotificationCount() const override; |
| 155 virtual size_t UnreadNotificationCount() const OVERRIDE; | 155 virtual size_t UnreadNotificationCount() const override; |
| 156 virtual bool HasPopupNotifications() const OVERRIDE; | 156 virtual bool HasPopupNotifications() const override; |
| 157 virtual bool IsQuietMode() const OVERRIDE; | 157 virtual bool IsQuietMode() const override; |
| 158 virtual bool HasClickedListener(const std::string& id) OVERRIDE; | 158 virtual bool HasClickedListener(const std::string& id) override; |
| 159 virtual message_center::Notification* FindVisibleNotificationById( | 159 virtual message_center::Notification* FindVisibleNotificationById( |
| 160 const std::string& id) OVERRIDE; | 160 const std::string& id) override; |
| 161 virtual const NotificationList::Notifications& GetVisibleNotifications() | 161 virtual const NotificationList::Notifications& GetVisibleNotifications() |
| 162 OVERRIDE; | 162 override; |
| 163 virtual NotificationList::PopupNotifications GetPopupNotifications() OVERRIDE; | 163 virtual NotificationList::PopupNotifications GetPopupNotifications() override; |
| 164 virtual void AddNotification(scoped_ptr<Notification> notification) OVERRIDE; | 164 virtual void AddNotification(scoped_ptr<Notification> notification) override; |
| 165 virtual void UpdateNotification(const std::string& old_id, | 165 virtual void UpdateNotification(const std::string& old_id, |
| 166 scoped_ptr<Notification> new_notification) | 166 scoped_ptr<Notification> new_notification) |
| 167 OVERRIDE; | 167 override; |
| 168 virtual void RemoveNotification(const std::string& id, bool by_user) OVERRIDE; | 168 virtual void RemoveNotification(const std::string& id, bool by_user) override; |
| 169 virtual void RemoveAllNotifications(bool by_user) OVERRIDE; | 169 virtual void RemoveAllNotifications(bool by_user) override; |
| 170 virtual void RemoveAllVisibleNotifications(bool by_user) OVERRIDE; | 170 virtual void RemoveAllVisibleNotifications(bool by_user) override; |
| 171 virtual void SetNotificationIcon(const std::string& notification_id, | 171 virtual void SetNotificationIcon(const std::string& notification_id, |
| 172 const gfx::Image& image) OVERRIDE; | 172 const gfx::Image& image) override; |
| 173 virtual void SetNotificationImage(const std::string& notification_id, | 173 virtual void SetNotificationImage(const std::string& notification_id, |
| 174 const gfx::Image& image) OVERRIDE; | 174 const gfx::Image& image) override; |
| 175 virtual void SetNotificationButtonIcon(const std::string& notification_id, | 175 virtual void SetNotificationButtonIcon(const std::string& notification_id, |
| 176 int button_index, | 176 int button_index, |
| 177 const gfx::Image& image) OVERRIDE; | 177 const gfx::Image& image) override; |
| 178 virtual void DisableNotificationsByNotifier( | 178 virtual void DisableNotificationsByNotifier( |
| 179 const NotifierId& notifier_id) OVERRIDE; | 179 const NotifierId& notifier_id) override; |
| 180 virtual void ClickOnNotification(const std::string& id) OVERRIDE; | 180 virtual void ClickOnNotification(const std::string& id) override; |
| 181 virtual void ClickOnNotificationButton(const std::string& id, | 181 virtual void ClickOnNotificationButton(const std::string& id, |
| 182 int button_index) OVERRIDE; | 182 int button_index) override; |
| 183 virtual void MarkSinglePopupAsShown(const std::string& id, | 183 virtual void MarkSinglePopupAsShown(const std::string& id, |
| 184 bool mark_notification_as_read) OVERRIDE; | 184 bool mark_notification_as_read) override; |
| 185 virtual void DisplayedNotification( | 185 virtual void DisplayedNotification( |
| 186 const std::string& id, | 186 const std::string& id, |
| 187 const DisplaySource source) OVERRIDE; | 187 const DisplaySource source) override; |
| 188 virtual void SetNotifierSettingsProvider( | 188 virtual void SetNotifierSettingsProvider( |
| 189 NotifierSettingsProvider* provider) OVERRIDE; | 189 NotifierSettingsProvider* provider) override; |
| 190 virtual NotifierSettingsProvider* GetNotifierSettingsProvider() OVERRIDE; | 190 virtual NotifierSettingsProvider* GetNotifierSettingsProvider() override; |
| 191 virtual void SetQuietMode(bool in_quiet_mode) OVERRIDE; | 191 virtual void SetQuietMode(bool in_quiet_mode) override; |
| 192 virtual void EnterQuietModeWithExpire( | 192 virtual void EnterQuietModeWithExpire( |
| 193 const base::TimeDelta& expires_in) OVERRIDE; | 193 const base::TimeDelta& expires_in) override; |
| 194 virtual void RestartPopupTimers() OVERRIDE; | 194 virtual void RestartPopupTimers() override; |
| 195 virtual void PausePopupTimers() OVERRIDE; | 195 virtual void PausePopupTimers() override; |
| 196 | 196 |
| 197 // NotificationBlocker::Observer overrides: | 197 // NotificationBlocker::Observer overrides: |
| 198 virtual void OnBlockingStateChanged(NotificationBlocker* blocker) OVERRIDE; | 198 virtual void OnBlockingStateChanged(NotificationBlocker* blocker) override; |
| 199 | 199 |
| 200 // message_center::NotifierSettingsObserver overrides: | 200 // message_center::NotifierSettingsObserver overrides: |
| 201 virtual void UpdateIconImage(const NotifierId& notifier_id, | 201 virtual void UpdateIconImage(const NotifierId& notifier_id, |
| 202 const gfx::Image& icon) OVERRIDE; | 202 const gfx::Image& icon) override; |
| 203 virtual void NotifierGroupChanged() OVERRIDE; | 203 virtual void NotifierGroupChanged() override; |
| 204 virtual void NotifierEnabledChanged(const NotifierId& notifier_id, | 204 virtual void NotifierEnabledChanged(const NotifierId& notifier_id, |
| 205 bool enabled) OVERRIDE; | 205 bool enabled) override; |
| 206 | 206 |
| 207 protected: | 207 protected: |
| 208 virtual void DisableTimersForTest() OVERRIDE; | 208 virtual void DisableTimersForTest() override; |
| 209 | 209 |
| 210 private: | 210 private: |
| 211 struct NotificationCache { | 211 struct NotificationCache { |
| 212 NotificationCache(); | 212 NotificationCache(); |
| 213 ~NotificationCache(); | 213 ~NotificationCache(); |
| 214 void Rebuild(const NotificationList::Notifications& notifications); | 214 void Rebuild(const NotificationList::Notifications& notifications); |
| 215 void RecountUnread(); | 215 void RecountUnread(); |
| 216 | 216 |
| 217 NotificationList::Notifications visible_notifications; | 217 NotificationList::Notifications visible_notifications; |
| 218 size_t unread_count; | 218 size_t unread_count; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 232 // Queue for the notifications to delay the addition/updates when the message | 232 // Queue for the notifications to delay the addition/updates when the message |
| 233 // center is visible. | 233 // center is visible. |
| 234 scoped_ptr<internal::ChangeQueue> notification_queue_; | 234 scoped_ptr<internal::ChangeQueue> notification_queue_; |
| 235 | 235 |
| 236 DISALLOW_COPY_AND_ASSIGN(MessageCenterImpl); | 236 DISALLOW_COPY_AND_ASSIGN(MessageCenterImpl); |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 } // namespace message_center | 239 } // namespace message_center |
| 240 | 240 |
| 241 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 241 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| OLD | NEW |