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