| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // | 67 // |
| 68 // TODO(miket): consider providing default implementations for the pure | 68 // TODO(miket): consider providing default implementations for the pure |
| 69 // virtuals above, to avoid changing so many files in disparate parts of | 69 // virtuals above, to avoid changing so many files in disparate parts of |
| 70 // the codebase each time we enhance this interface. | 70 // the codebase each time we enhance this interface. |
| 71 virtual void OnButtonClicked(const std::string& id, int button_index); | 71 virtual void OnButtonClicked(const std::string& id, int button_index); |
| 72 | 72 |
| 73 protected: | 73 protected: |
| 74 virtual ~Delegate() {} | 74 virtual ~Delegate() {} |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 static MessageCenter* GetInstance(); | 77 MessageCenter(); |
| 78 | |
| 79 virtual ~MessageCenter(); | 78 virtual ~MessageCenter(); |
| 80 | 79 |
| 81 // Called to set the delegate. Generally called only once, except in tests. | 80 // Called to set the delegate. Generally called only once, except in tests. |
| 82 // Changing the delegate does not affect notifications in its | 81 // Changing the delegate does not affect notifications in its |
| 83 // NotificationList. | 82 // NotificationList. |
| 84 void SetDelegate(Delegate* delegate); | 83 void SetDelegate(Delegate* delegate); |
| 85 | 84 |
| 86 // Management of the observer list. | 85 // Management of the observer list. |
| 87 void AddObserver(Observer* observer); | 86 void AddObserver(Observer* observer); |
| 88 void RemoveObserver(Observer* observer); | 87 void RemoveObserver(Observer* observer); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE; | 138 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE; |
| 140 virtual void DisableNotificationByUrl(const std::string& id) OVERRIDE; | 139 virtual void DisableNotificationByUrl(const std::string& id) OVERRIDE; |
| 141 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; | 140 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; |
| 142 virtual void OnNotificationClicked(const std::string& id) OVERRIDE; | 141 virtual void OnNotificationClicked(const std::string& id) OVERRIDE; |
| 143 virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE; | 142 virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE; |
| 144 virtual void OnButtonClicked(const std::string& id, int button_index) | 143 virtual void OnButtonClicked(const std::string& id, int button_index) |
| 145 OVERRIDE; | 144 OVERRIDE; |
| 146 virtual NotificationList* GetNotificationList() OVERRIDE; | 145 virtual NotificationList* GetNotificationList() OVERRIDE; |
| 147 | 146 |
| 148 private: | 147 private: |
| 149 friend struct DefaultSingletonTraits<MessageCenter>; | |
| 150 MessageCenter(); | |
| 151 | |
| 152 // Calls OnMessageCenterChanged on each observer. | 148 // Calls OnMessageCenterChanged on each observer. |
| 153 void NotifyMessageCenterChanged(bool new_notification); | 149 void NotifyMessageCenterChanged(bool new_notification); |
| 154 | 150 |
| 155 scoped_ptr<NotificationList> notification_list_; | 151 scoped_ptr<NotificationList> notification_list_; |
| 156 ObserverList<Observer> observer_list_; | 152 ObserverList<Observer> observer_list_; |
| 157 Delegate* delegate_; | 153 Delegate* delegate_; |
| 158 | 154 |
| 159 DISALLOW_COPY_AND_ASSIGN(MessageCenter); | 155 DISALLOW_COPY_AND_ASSIGN(MessageCenter); |
| 160 }; | 156 }; |
| 161 | 157 |
| 162 } // namespace message_center | 158 } // namespace message_center |
| 163 | 159 |
| 164 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 160 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| OLD | NEW |