| 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_NOTIFIER_SETTINGS_H_ | 5 #ifndef UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| 6 #define UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ | 6 #define UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" |
| 10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 11 #include "ui/gfx/image/image.h" | 12 #include "ui/gfx/image/image.h" |
| 12 #include "ui/message_center/message_center_export.h" | 13 #include "ui/message_center/message_center_export.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 | 15 |
| 16 FORWARD_DECLARE_TEST(MessageCenterTrayBridgeTest, |
| 17 StatusItemOnlyAfterFirstNotification); |
| 18 |
| 19 namespace ash { |
| 20 class WebNotificationTrayTest; |
| 21 } |
| 22 |
| 15 namespace message_center { | 23 namespace message_center { |
| 24 namespace test { |
| 25 class MessagePopupCollectionTest; |
| 26 } |
| 16 | 27 |
| 17 class NotifierSettingsDelegate; | 28 class NotifierSettingsDelegate; |
| 18 class NotifierSettingsProvider; | 29 class NotifierSettingsProvider; |
| 19 | 30 |
| 20 // Brings up the settings dialog and returns a weak reference to the delegate, | 31 // Brings up the settings dialog and returns a weak reference to the delegate, |
| 21 // which is typically the view. If the dialog already exists, it is brought to | 32 // which is typically the view. If the dialog already exists, it is brought to |
| 22 // the front, otherwise it is created. | 33 // the front, otherwise it is created. |
| 23 MESSAGE_CENTER_EXPORT NotifierSettingsDelegate* ShowSettings( | 34 MESSAGE_CENTER_EXPORT NotifierSettingsDelegate* ShowSettings( |
| 24 NotifierSettingsProvider* provider, | 35 NotifierSettingsProvider* provider, |
| 25 gfx::NativeView context); | 36 gfx::NativeView context); |
| 26 | 37 |
| 27 // The struct to distinguish the notifiers. | 38 // The struct to distinguish the notifiers. |
| 28 struct MESSAGE_CENTER_EXPORT NotifierId { | 39 struct MESSAGE_CENTER_EXPORT NotifierId { |
| 29 enum NotifierType { | 40 enum NotifierType { |
| 30 APPLICATION, | 41 APPLICATION, |
| 31 WEB_PAGE, | 42 WEB_PAGE, |
| 32 SYSTEM_COMPONENT, | 43 SYSTEM_COMPONENT, |
| 33 SYNCED_NOTIFICATION_SERVICE, | 44 SYNCED_NOTIFICATION_SERVICE, |
| 34 }; | 45 }; |
| 35 | 46 |
| 36 // Constructor for non WEB_PAGE type. | 47 // Constructor for non WEB_PAGE type. |
| 37 NotifierId(NotifierType type, const std::string& id); | 48 NotifierId(NotifierType type, const std::string& id); |
| 38 | 49 |
| 39 // Constructor for WEB_PAGE type. | 50 // Constructor for WEB_PAGE type. |
| 40 explicit NotifierId(const GURL& url); | 51 explicit NotifierId(const GURL& url); |
| 41 | 52 |
| 42 // The default constructor which doesn't specify the notifier. Used for tests. | |
| 43 NotifierId(); | |
| 44 | |
| 45 bool operator==(const NotifierId& other) const; | 53 bool operator==(const NotifierId& other) const; |
| 46 | 54 |
| 47 NotifierType type; | 55 NotifierType type; |
| 48 | 56 |
| 49 // The identifier of the app notifier. Empty if it's WEB_PAGE. | 57 // The identifier of the app notifier. Empty if it's WEB_PAGE. |
| 50 std::string id; | 58 std::string id; |
| 51 | 59 |
| 52 // The URL pattern of the notifer. | 60 // The URL pattern of the notifer. |
| 53 GURL url; | 61 GURL url; |
| 54 | 62 |
| 55 // The identifier of the profile where the notification is created. This is | 63 // The identifier of the profile where the notification is created. This is |
| 56 // used for ChromeOS multi-profile support and can be empty. | 64 // used for ChromeOS multi-profile support and can be empty. |
| 57 std::string profile_id; | 65 std::string profile_id; |
| 66 |
| 67 private: |
| 68 friend class MessageCenterTrayTest; |
| 69 friend class test::MessagePopupCollectionTest; |
| 70 friend class NotificationControllerTest; |
| 71 friend class PopupCollectionTest; |
| 72 friend class TrayViewControllerTest; |
| 73 friend class ash::WebNotificationTrayTest; |
| 74 FRIEND_TEST_ALL_PREFIXES(::MessageCenterTrayBridgeTest, |
| 75 StatusItemOnlyAfterFirstNotification); |
| 76 FRIEND_TEST_ALL_PREFIXES(PopupControllerTest, Creation); |
| 77 FRIEND_TEST_ALL_PREFIXES(NotificationListTest, UnreadCountNoNegative); |
| 78 FRIEND_TEST_ALL_PREFIXES(NotificationListTest, TestHasNotificationOfType); |
| 79 |
| 80 // The default constructor which doesn't specify the notifier. Used for tests. |
| 81 NotifierId(); |
| 58 }; | 82 }; |
| 59 | 83 |
| 60 // The struct to hold the information of notifiers. The information will be | 84 // The struct to hold the information of notifiers. The information will be |
| 61 // used by NotifierSettingsView. | 85 // used by NotifierSettingsView. |
| 62 struct MESSAGE_CENTER_EXPORT Notifier { | 86 struct MESSAGE_CENTER_EXPORT Notifier { |
| 63 Notifier(const NotifierId& notifier_id, const string16& name, bool enabled); | 87 Notifier(const NotifierId& notifier_id, const string16& name, bool enabled); |
| 64 ~Notifier(); | 88 ~Notifier(); |
| 65 | 89 |
| 66 NotifierId notifier_id; | 90 NotifierId notifier_id; |
| 67 | 91 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 185 |
| 162 // Called upon request for more information about a particular notifier. | 186 // Called upon request for more information about a particular notifier. |
| 163 virtual void OnNotifierAdvancedSettingsRequested( | 187 virtual void OnNotifierAdvancedSettingsRequested( |
| 164 const NotifierId& notifier_id, | 188 const NotifierId& notifier_id, |
| 165 const std::string* notification_id) = 0; | 189 const std::string* notification_id) = 0; |
| 166 }; | 190 }; |
| 167 | 191 |
| 168 } // namespace message_center | 192 } // namespace message_center |
| 169 | 193 |
| 170 #endif // UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ | 194 #endif // UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| OLD | NEW |