| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 Profile* profile, | 86 Profile* profile, |
| 87 const std::string& extension_id) const; | 87 const std::string& extension_id) const; |
| 88 | 88 |
| 89 FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest, | 89 FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest, |
| 90 ManuallyCloseMessageCenter); | 90 ManuallyCloseMessageCenter); |
| 91 | 91 |
| 92 std::unique_ptr<message_center::MessageCenterTrayDelegate> tray_; | 92 std::unique_ptr<message_center::MessageCenterTrayDelegate> tray_; |
| 93 message_center::MessageCenter* message_center_; // Weak, global. | 93 message_center::MessageCenter* message_center_; // Weak, global. |
| 94 | 94 |
| 95 // Use a map by notification_id since this mapping is the most often used. | 95 // Use a map by notification_id since this mapping is the most often used. |
| 96 typedef std::map<std::string, ProfileNotification*> NotificationMap; | 96 std::map<std::string, std::unique_ptr<ProfileNotification>> |
| 97 NotificationMap profile_notifications_; | 97 profile_notifications_; |
| 98 | 98 |
| 99 // Helpers that add/remove the notification from local map. | 99 // Helpers that add/remove the notification from local map. |
| 100 // The local map takes ownership of profile_notification object. | 100 // The local map takes ownership of profile_notification object. |
| 101 void AddProfileNotification(ProfileNotification* profile_notification); | 101 void AddProfileNotification( |
| 102 std::unique_ptr<ProfileNotification> profile_notification); |
| 102 void RemoveProfileNotification(ProfileNotification* profile_notification); | 103 void RemoveProfileNotification(ProfileNotification* profile_notification); |
| 103 | 104 |
| 104 // Returns the ProfileNotification for the |id|, or NULL if no such | 105 // Returns the ProfileNotification for the |id|, or NULL if no such |
| 105 // notification is found. | 106 // notification is found. |
| 106 ProfileNotification* FindProfileNotification(const std::string& id) const; | 107 ProfileNotification* FindProfileNotification(const std::string& id) const; |
| 107 | 108 |
| 108 // Get the extension ID of the extension that the user chose to take over | 109 // Get the extension ID of the extension that the user chose to take over |
| 109 // Chorme Notification Center. | 110 // Chorme Notification Center. |
| 110 std::string GetExtensionTakingOverNotifications(Profile* profile); | 111 std::string GetExtensionTakingOverNotifications(Profile* profile); |
| 111 | 112 |
| 112 std::unique_ptr<message_center::NotifierSettingsProvider> settings_provider_; | 113 std::unique_ptr<message_center::NotifierSettingsProvider> settings_provider_; |
| 113 | 114 |
| 114 // To own the blockers. | 115 // To own the blockers. |
| 115 std::vector<std::unique_ptr<message_center::NotificationBlocker>> blockers_; | 116 std::vector<std::unique_ptr<message_center::NotificationBlocker>> blockers_; |
| 116 | 117 |
| 117 NotificationSystemObserver system_observer_; | 118 NotificationSystemObserver system_observer_; |
| 118 | 119 |
| 119 // Keeps track of all notification statistics for UMA purposes. | 120 // Keeps track of all notification statistics for UMA purposes. |
| 120 MessageCenterStatsCollector stats_collector_; | 121 MessageCenterStatsCollector stats_collector_; |
| 121 | 122 |
| 122 // Keeps track of notifications specific to Google Now for UMA purposes. | 123 // Keeps track of notifications specific to Google Now for UMA purposes. |
| 123 GoogleNowNotificationStatsCollector google_now_stats_collector_; | 124 GoogleNowNotificationStatsCollector google_now_stats_collector_; |
| 124 | 125 |
| 125 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); | 126 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 129 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |