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 virtual void ShowSettingsDialog(gfx::NativeView context) = 0; | |
Daniel Erat
2013/01/24 03:16:21
nit: add a short comment describing what this does
Jun Mukai
2013/01/24 04:04:30
Done.
| |
63 | |
61 // Called when the notification body is clicked on. | 64 // Called when the notification body is clicked on. |
62 virtual void OnClicked(const std::string& notification_id) = 0; | 65 virtual void OnClicked(const std::string& notification_id) = 0; |
63 | 66 |
64 // Called when a button in a notification is clicked. |button_index| | 67 // Called when a button in a notification is clicked. |button_index| |
65 // indicates which button was clicked, zero-indexed (button one is 0, | 68 // indicates which button was clicked, zero-indexed (button one is 0, |
66 // button two is 1). | 69 // button two is 1). |
67 // | 70 // |
68 // TODO(miket): consider providing default implementations for the pure | 71 // TODO(miket): consider providing default implementations for the pure |
69 // virtuals above, to avoid changing so many files in disparate parts of | 72 // virtuals above, to avoid changing so many files in disparate parts of |
70 // the codebase each time we enhance this interface. | 73 // the codebase each time we enhance this interface. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 void SetNotificationImage(const std::string& id, const gfx::ImageSkia& image); | 135 void SetNotificationImage(const std::string& id, const gfx::ImageSkia& image); |
133 | 136 |
134 NotificationList* notification_list() { return notification_list_.get(); } | 137 NotificationList* notification_list() { return notification_list_.get(); } |
135 | 138 |
136 // Overridden from NotificationList::Delegate. | 139 // Overridden from NotificationList::Delegate. |
137 virtual void SendRemoveNotification(const std::string& id) OVERRIDE; | 140 virtual void SendRemoveNotification(const std::string& id) OVERRIDE; |
138 virtual void SendRemoveAllNotifications() OVERRIDE; | 141 virtual void SendRemoveAllNotifications() OVERRIDE; |
139 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE; | 142 virtual void DisableNotificationByExtension(const std::string& id) OVERRIDE; |
140 virtual void DisableNotificationByUrl(const std::string& id) OVERRIDE; | 143 virtual void DisableNotificationByUrl(const std::string& id) OVERRIDE; |
141 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; | 144 virtual void ShowNotificationSettings(const std::string& id) OVERRIDE; |
145 virtual void ShowNotificationSettingsDialog(gfx::NativeView context) OVERRIDE; | |
142 virtual void OnNotificationClicked(const std::string& id) OVERRIDE; | 146 virtual void OnNotificationClicked(const std::string& id) OVERRIDE; |
143 virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE; | 147 virtual void OnQuietModeChanged(bool quiet_mode) OVERRIDE; |
144 virtual void OnButtonClicked(const std::string& id, int button_index) | 148 virtual void OnButtonClicked(const std::string& id, int button_index) |
145 OVERRIDE; | 149 OVERRIDE; |
146 virtual NotificationList* GetNotificationList() OVERRIDE; | 150 virtual NotificationList* GetNotificationList() OVERRIDE; |
147 | 151 |
148 private: | 152 private: |
149 friend struct DefaultSingletonTraits<MessageCenter>; | 153 friend struct DefaultSingletonTraits<MessageCenter>; |
150 MessageCenter(); | 154 MessageCenter(); |
151 | 155 |
152 // Calls OnMessageCenterChanged on each observer. | 156 // Calls OnMessageCenterChanged on each observer. |
153 void NotifyMessageCenterChanged(bool new_notification); | 157 void NotifyMessageCenterChanged(bool new_notification); |
154 | 158 |
155 scoped_ptr<NotificationList> notification_list_; | 159 scoped_ptr<NotificationList> notification_list_; |
156 ObserverList<Observer> observer_list_; | 160 ObserverList<Observer> observer_list_; |
157 Delegate* delegate_; | 161 Delegate* delegate_; |
158 | 162 |
159 DISALLOW_COPY_AND_ASSIGN(MessageCenter); | 163 DISALLOW_COPY_AND_ASSIGN(MessageCenter); |
160 }; | 164 }; |
161 | 165 |
162 } // namespace message_center | 166 } // namespace message_center |
163 | 167 |
164 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ | 168 #endif // UI_MESSAGE_CENTER_MESSAGE_CENTER_H_ |
OLD | NEW |