| 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 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 } // namespace internal | 129 } // namespace internal |
| 130 | 130 |
| 131 // The default implementation of MessageCenter. | 131 // The default implementation of MessageCenter. |
| 132 class MessageCenterImpl : public MessageCenter { | 132 class MessageCenterImpl : public MessageCenter { |
| 133 public: | 133 public: |
| 134 MessageCenterImpl(); | 134 MessageCenterImpl(); |
| 135 virtual ~MessageCenterImpl(); | 135 virtual ~MessageCenterImpl(); |
| 136 | 136 |
| 137 // MessageCenter overrides: | 137 // MessageCenter overrides: |
| 138 virtual void SetDelegate(Delegate* delegate) OVERRIDE; | |
| 139 virtual void AddObserver(MessageCenterObserver* observer) OVERRIDE; | 138 virtual void AddObserver(MessageCenterObserver* observer) OVERRIDE; |
| 140 virtual void RemoveObserver(MessageCenterObserver* observer) OVERRIDE; | 139 virtual void RemoveObserver(MessageCenterObserver* observer) OVERRIDE; |
| 141 virtual void SetMessageCenterVisible(bool visible) OVERRIDE; | 140 virtual void SetVisibility(Visibility visible) OVERRIDE; |
| 142 virtual bool IsMessageCenterVisible() OVERRIDE; | 141 virtual bool IsMessageCenterVisible() OVERRIDE; |
| 143 virtual size_t NotificationCount() const OVERRIDE; | 142 virtual size_t NotificationCount() const OVERRIDE; |
| 144 virtual size_t UnreadNotificationCount() const OVERRIDE; | 143 virtual size_t UnreadNotificationCount() const OVERRIDE; |
| 145 virtual bool HasPopupNotifications() const OVERRIDE; | 144 virtual bool HasPopupNotifications() const OVERRIDE; |
| 146 virtual bool HasNotification(const std::string& id) OVERRIDE; | 145 virtual bool HasNotification(const std::string& id) OVERRIDE; |
| 147 virtual bool IsQuietMode() const OVERRIDE; | 146 virtual bool IsQuietMode() const OVERRIDE; |
| 148 virtual bool HasClickedListener(const std::string& id) OVERRIDE; | 147 virtual bool HasClickedListener(const std::string& id) OVERRIDE; |
| 149 virtual const NotificationList::Notifications& GetNotifications() OVERRIDE; | 148 virtual const NotificationList::Notifications& GetNotifications() OVERRIDE; |
| 150 virtual NotificationList::PopupNotifications GetPopupNotifications() OVERRIDE; | 149 virtual NotificationList::PopupNotifications GetPopupNotifications() OVERRIDE; |
| 151 virtual void AddNotification(scoped_ptr<Notification> notification) OVERRIDE; | 150 virtual void AddNotification(scoped_ptr<Notification> notification) OVERRIDE; |
| 152 virtual void UpdateNotification(const std::string& old_id, | 151 virtual void UpdateNotification(const std::string& old_id, |
| 153 scoped_ptr<Notification> new_notification) | 152 scoped_ptr<Notification> new_notification) |
| 154 OVERRIDE; | 153 OVERRIDE; |
| 155 virtual void RemoveNotification(const std::string& id, bool by_user) OVERRIDE; | 154 virtual void RemoveNotification(const std::string& id, bool by_user) OVERRIDE; |
| 156 virtual void RemoveAllNotifications(bool by_user) OVERRIDE; | 155 virtual void RemoveAllNotifications(bool by_user) OVERRIDE; |
| 157 virtual void SetNotificationIcon(const std::string& notification_id, | 156 virtual void SetNotificationIcon(const std::string& notification_id, |
| 158 const gfx::Image& image) OVERRIDE; | 157 const gfx::Image& image) OVERRIDE; |
| 159 virtual void SetNotificationImage(const std::string& notification_id, | 158 virtual void SetNotificationImage(const std::string& notification_id, |
| 160 const gfx::Image& image) OVERRIDE; | 159 const gfx::Image& image) OVERRIDE; |
| 161 virtual void SetNotificationButtonIcon(const std::string& notification_id, | 160 virtual void SetNotificationButtonIcon(const std::string& notification_id, |
| 162 int button_index, | 161 int button_index, |
| 163 const gfx::Image& image) OVERRIDE; | 162 const gfx::Image& image) OVERRIDE; |
| 164 virtual void DisableNotificationsByNotifier( | 163 virtual void DisableNotificationsByNotifier( |
| 165 const NotifierId& notifier_id) OVERRIDE; | 164 const NotifierId& notifier_id) OVERRIDE; |
| 166 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; | |
| 167 virtual void ExpandNotification(const std::string& id) OVERRIDE; | 165 virtual void ExpandNotification(const std::string& id) OVERRIDE; |
| 168 virtual void ClickOnNotification(const std::string& id) OVERRIDE; | 166 virtual void ClickOnNotification(const std::string& id) OVERRIDE; |
| 169 virtual void ClickOnNotificationButton(const std::string& id, | 167 virtual void ClickOnNotificationButton(const std::string& id, |
| 170 int button_index) OVERRIDE; | 168 int button_index) OVERRIDE; |
| 171 virtual void MarkSinglePopupAsShown(const std::string& id, | 169 virtual void MarkSinglePopupAsShown(const std::string& id, |
| 172 bool mark_notification_as_read) OVERRIDE; | 170 bool mark_notification_as_read) OVERRIDE; |
| 173 virtual void DisplayedNotification(const std::string& id) OVERRIDE; | 171 virtual void DisplayedNotification(const std::string& id) OVERRIDE; |
| 174 virtual void SetNotifierSettingsProvider( | 172 virtual void SetNotifierSettingsProvider( |
| 175 NotifierSettingsProvider* provider) OVERRIDE; | 173 NotifierSettingsProvider* provider) OVERRIDE; |
| 176 virtual NotifierSettingsProvider* GetNotifierSettingsProvider() OVERRIDE; | 174 virtual NotifierSettingsProvider* GetNotifierSettingsProvider() OVERRIDE; |
| 177 virtual void SetQuietMode(bool in_quiet_mode) OVERRIDE; | 175 virtual void SetQuietMode(bool in_quiet_mode) OVERRIDE; |
| 178 virtual void EnterQuietModeWithExpire( | 176 virtual void EnterQuietModeWithExpire( |
| 179 const base::TimeDelta& expires_in) OVERRIDE; | 177 const base::TimeDelta& expires_in) OVERRIDE; |
| 180 virtual void RestartPopupTimers() OVERRIDE; | 178 virtual void RestartPopupTimers() OVERRIDE; |
| 181 virtual void PausePopupTimers() OVERRIDE; | 179 virtual void PausePopupTimers() OVERRIDE; |
| 182 | 180 |
| 183 protected: | 181 protected: |
| 184 virtual void DisableTimersForTest() OVERRIDE; | 182 virtual void DisableTimersForTest() OVERRIDE; |
| 185 | 183 |
| 186 private: | 184 private: |
| 187 scoped_ptr<NotificationList> notification_list_; | 185 scoped_ptr<NotificationList> notification_list_; |
| 188 ObserverList<MessageCenterObserver> observer_list_; | 186 ObserverList<MessageCenterObserver> observer_list_; |
| 189 scoped_ptr<internal::PopupTimersController> popup_timers_controller_; | 187 scoped_ptr<internal::PopupTimersController> popup_timers_controller_; |
| 190 scoped_ptr<base::OneShotTimer<MessageCenterImpl> > quiet_mode_timer_; | 188 scoped_ptr<base::OneShotTimer<MessageCenterImpl> > quiet_mode_timer_; |
| 191 Delegate* delegate_; | |
| 192 NotifierSettingsProvider* settings_provider_; | 189 NotifierSettingsProvider* settings_provider_; |
| 193 | 190 |
| 194 DISALLOW_COPY_AND_ASSIGN(MessageCenterImpl); | 191 DISALLOW_COPY_AND_ASSIGN(MessageCenterImpl); |
| 195 }; | 192 }; |
| 196 | 193 |
| 197 } // namespace message_center | 194 } // namespace message_center |
| 198 | 195 |
| 199 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 196 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| OLD | NEW |