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 CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Takes ownership of |delegate|. | 72 // Takes ownership of |delegate|. |
73 void SetMessageCenterTrayDelegateForTest( | 73 void SetMessageCenterTrayDelegateForTest( |
74 message_center::MessageCenterTrayDelegate* delegate); | 74 message_center::MessageCenterTrayDelegate* delegate); |
75 | 75 |
76 // Returns the notification id which this manager will use to add to message | 76 // Returns the notification id which this manager will use to add to message |
77 // center, for this combination of delegate id and profile. | 77 // center, for this combination of delegate id and profile. |
78 std::string GetMessageCenterNotificationIdForTest( | 78 std::string GetMessageCenterNotificationIdForTest( |
79 const std::string& delegate_id, Profile* profile); | 79 const std::string& delegate_id, Profile* profile); |
80 | 80 |
81 private: | 81 private: |
82 // Adds |profile_notification| to an alternative provider extension or app. | |
83 void AddNotificationToAlternateProvider( | |
84 const Notification& notification, | |
85 Profile* profile, | |
86 const std::string& extension_id) const; | |
87 | |
88 FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest, | 82 FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest, |
89 ManuallyCloseMessageCenter); | 83 ManuallyCloseMessageCenter); |
90 | 84 |
91 std::unique_ptr<message_center::MessageCenterTrayDelegate> tray_; | 85 std::unique_ptr<message_center::MessageCenterTrayDelegate> tray_; |
92 message_center::MessageCenter* message_center_; // Weak, global. | 86 message_center::MessageCenter* message_center_; // Weak, global. |
93 | 87 |
94 // Use a map by notification_id since this mapping is the most often used. | 88 // Use a map by notification_id since this mapping is the most often used. |
95 std::map<std::string, std::unique_ptr<ProfileNotification>> | 89 std::map<std::string, std::unique_ptr<ProfileNotification>> |
96 profile_notifications_; | 90 profile_notifications_; |
97 | 91 |
98 // Helpers that add/remove the notification from local map. | 92 // Helpers that add/remove the notification from local map. |
99 // The local map takes ownership of profile_notification object. | 93 // The local map takes ownership of profile_notification object. |
100 void AddProfileNotification( | 94 void AddProfileNotification( |
101 std::unique_ptr<ProfileNotification> profile_notification); | 95 std::unique_ptr<ProfileNotification> profile_notification); |
102 void RemoveProfileNotification(const std::string& notification_id); | 96 void RemoveProfileNotification(const std::string& notification_id); |
103 | 97 |
104 // Returns the ProfileNotification for the |id|, or NULL if no such | 98 // Returns the ProfileNotification for the |id|, or NULL if no such |
105 // notification is found. | 99 // notification is found. |
106 ProfileNotification* FindProfileNotification(const std::string& id) const; | 100 ProfileNotification* FindProfileNotification(const std::string& id) const; |
107 | 101 |
108 // Get the extension ID of the extension that the user chose to take over | |
109 // Chorme Notification Center. | |
110 std::string GetExtensionTakingOverNotifications(Profile* profile); | |
111 | |
112 std::unique_ptr<message_center::NotifierSettingsProvider> settings_provider_; | 102 std::unique_ptr<message_center::NotifierSettingsProvider> settings_provider_; |
113 | 103 |
114 // To own the blockers. | 104 // To own the blockers. |
115 std::vector<std::unique_ptr<message_center::NotificationBlocker>> blockers_; | 105 std::vector<std::unique_ptr<message_center::NotificationBlocker>> blockers_; |
116 | 106 |
117 NotificationSystemObserver system_observer_; | 107 NotificationSystemObserver system_observer_; |
118 | 108 |
119 // Keeps track of all notification statistics for UMA purposes. | 109 // Keeps track of all notification statistics for UMA purposes. |
120 MessageCenterStatsCollector stats_collector_; | 110 MessageCenterStatsCollector stats_collector_; |
121 | 111 |
122 // Keeps track of notifications specific to Google Now for UMA purposes. | 112 // Keeps track of notifications specific to Google Now for UMA purposes. |
123 GoogleNowNotificationStatsCollector google_now_stats_collector_; | 113 GoogleNowNotificationStatsCollector google_now_stats_collector_; |
124 | 114 |
125 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); | 115 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); |
126 }; | 116 }; |
127 | 117 |
128 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 118 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
OLD | NEW |