| 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" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/message_center/message_center_export.h" | 13 #include "ui/message_center/message_center_export.h" |
| 13 #include "ui/message_center/notification_list.h" | 14 #include "ui/message_center/notification_list.h" |
| 14 #include "ui/notifications/notification_types.h" | 15 #include "ui/notifications/notification_types.h" |
| 15 | 16 |
| 16 template <typename T> struct DefaultSingletonTraits; | 17 template <typename T> struct DefaultSingletonTraits; |
| 17 | 18 |
| 18 namespace base { | 19 namespace base { |
| 19 class DictionaryValue; | 20 class DictionaryValue; |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 51 virtual void DisableExtension(const std::string& notification_id) = 0; | 52 virtual void DisableExtension(const std::string& notification_id) = 0; |
| 52 | 53 |
| 53 // Request to disable notifications from the source of |notification_id|. | 54 // Request to disable notifications from the source of |notification_id|. |
| 54 virtual void DisableNotificationsFromSource( | 55 virtual void DisableNotificationsFromSource( |
| 55 const std::string& notification_id) = 0; | 56 const std::string& notification_id) = 0; |
| 56 | 57 |
| 57 // Request to show the notification settings (|notification_id| is used | 58 // Request to show the notification settings (|notification_id| is used |
| 58 // to identify the requesting browser context). | 59 // to identify the requesting browser context). |
| 59 virtual void ShowSettings(const std::string& notification_id) = 0; | 60 virtual void ShowSettings(const std::string& notification_id) = 0; |
| 60 | 61 |
| 62 // Request to show the notification settings dialog. |context| is necessary |
| 63 // to create a new window. |
| 64 virtual void ShowSettingsDialog(gfx::NativeView context) = 0; |
| 65 |
| 61 // Called when the notification body is clicked on. | 66 // Called when the notification body is clicked on. |
| 62 virtual void OnClicked(const std::string& notification_id) = 0; | 67 virtual void OnClicked(const std::string& notification_id) = 0; |
| 63 | 68 |
| 64 // Called when a button in a notification is clicked. |button_index| | 69 // Called when a button in a notification is clicked. |button_index| |
| 65 // indicates which button was clicked, zero-indexed (button one is 0, | 70 // indicates which button was clicked, zero-indexed (button one is 0, |
| 66 // button two is 1). | 71 // button two is 1). |
| 67 // | 72 // |
| 68 // TODO(miket): consider providing default implementations for the pure | 73 // TODO(miket): consider providing default implementations for the pure |
| 69 // virtuals above, to avoid changing so many files in disparate parts of | 74 // virtuals above, to avoid changing so many files in disparate parts of |
| 70 // the codebase each time we enhance this interface. | 75 // the codebase each time we enhance this interface. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const gfx::ImageSkia& image); | 138 const gfx::ImageSkia& image); |
| 134 | 139 |
| 135 NotificationList* notification_list() { return notification_list_.get(); } | 140 NotificationList* notification_list() { return notification_list_.get(); } |
| 136 | 141 |
| 137 // Overridden from NotificationList::Delegate. | 142 // Overridden from NotificationList::Delegate. |
| 138 virtual void SendRemoveNotification(const std::string& id) OVERRIDE; | 143 virtual void SendRemoveNotification(const std::string& id) OVERRIDE; |
| 139 virtual void SendRemoveAllNotifications() OVERRIDE; | 144 virtual void SendRemoveAllNotifications() OVERRIDE; |
| 140 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE; | 145 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE; |
| 141 virtual void DisableNotificationByUrl(const std::string& id) OVERRIDE; | 146 virtual void DisableNotificationByUrl(const std::string& id) OVERRIDE; |
| 142 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; | 147 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; |
| 148 virtual void ShowNotificationSettingsDialog(gfx::NativeView context) OVERRIDE; |
| 143 virtual void OnNotificationClicked(const std::string& id) OVERRIDE; | 149 virtual void OnNotificationClicked(const std::string& id) OVERRIDE; |
| 144 virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE; | 150 virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE; |
| 145 virtual void OnButtonClicked(const std::string& id, int button_index) | 151 virtual void OnButtonClicked(const std::string& id, int button_index) |
| 146 OVERRIDE; | 152 OVERRIDE; |
| 147 virtual NotificationList* GetNotificationList() OVERRIDE; | 153 virtual NotificationList* GetNotificationList() OVERRIDE; |
| 148 | 154 |
| 149 private: | 155 private: |
| 150 // Calls OnMessageCenterChanged on each observer. | 156 // Calls OnMessageCenterChanged on each observer. |
| 151 void NotifyMessageCenterChanged(bool new_notification); | 157 void NotifyMessageCenterChanged(bool new_notification); |
| 152 | 158 |
| 153 scoped_ptr<NotificationList> notification_list_; | 159 scoped_ptr<NotificationList> notification_list_; |
| 154 ObserverList<Observer> observer_list_; | 160 ObserverList<Observer> observer_list_; |
| 155 Delegate* delegate_; | 161 Delegate* delegate_; |
| 156 | 162 |
| 157 DISALLOW_COPY_AND_ASSIGN(MessageCenter); | 163 DISALLOW_COPY_AND_ASSIGN(MessageCenter); |
| 158 }; | 164 }; |
| 159 | 165 |
| 160 } // namespace message_center | 166 } // namespace message_center |
| 161 | 167 |
| 162 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 168 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
| OLD | NEW |