| 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 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/notifications/notification_ui_manager.h" | 21 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 22 #include "ui/message_center/message_center.h" | 22 #include "ui/message_center/message_center.h" |
| 23 #include "ui/message_center/message_center_observer.h" | 23 #include "ui/message_center/message_center_observer.h" |
| 24 #include "ui/message_center/message_center_tray_delegate.h" | 24 #include "ui/message_center/message_center_tray_delegate.h" |
| 25 #include "ui/message_center/message_center_types.h" | 25 #include "ui/message_center/message_center_types.h" |
| 26 | 26 |
| 27 class Notification; | 27 class Notification; |
| 28 class Profile; | 28 class Profile; |
| 29 class ProfileNotification; | 29 class ProfileNotification; |
| 30 | 30 |
| 31 #if defined(USE_GLIB) && defined(USE_GIO) |
| 32 class DbusNotificationManager; |
| 33 #endif |
| 34 |
| 31 namespace message_center { | 35 namespace message_center { |
| 32 class NotificationBlocker; | 36 class NotificationBlocker; |
| 33 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManuallyCloseMessageCenter); | 37 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManuallyCloseMessageCenter); |
| 34 } | 38 } |
| 35 | 39 |
| 36 // This class extends NotificationUIManagerImpl and delegates actual display | 40 // This class extends NotificationUIManagerImpl and delegates actual display |
| 37 // of notifications to MessageCenter, doing necessary conversions. | 41 // of notifications to MessageCenter, doing necessary conversions. |
| 38 class MessageCenterNotificationManager | 42 class MessageCenterNotificationManager |
| 39 : public NotificationUIManager, | 43 : public NotificationUIManager, |
| 40 public message_center::MessageCenterObserver { | 44 public message_center::MessageCenterObserver { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 78 |
| 75 // Returns the notification id which this manager will use to add to message | 79 // Returns the notification id which this manager will use to add to message |
| 76 // center, for this combination of delegate id and profile. | 80 // center, for this combination of delegate id and profile. |
| 77 std::string GetMessageCenterNotificationIdForTest( | 81 std::string GetMessageCenterNotificationIdForTest( |
| 78 const std::string& delegate_id, Profile* profile); | 82 const std::string& delegate_id, Profile* profile); |
| 79 | 83 |
| 80 private: | 84 private: |
| 81 FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest, | 85 FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest, |
| 82 ManuallyCloseMessageCenter); | 86 ManuallyCloseMessageCenter); |
| 83 | 87 |
| 88 #if defined(USE_GLIB) && defined(USE_GIO) |
| 89 std::unique_ptr<DbusNotificationManager> dbus_notification_manager_; |
| 90 #endif |
| 84 std::unique_ptr<message_center::MessageCenterTrayDelegate> tray_; | 91 std::unique_ptr<message_center::MessageCenterTrayDelegate> tray_; |
| 85 message_center::MessageCenter* message_center_; // Weak, global. | 92 message_center::MessageCenter* message_center_; // Weak, global. |
| 86 | 93 |
| 87 // Use a map by notification_id since this mapping is the most often used. | 94 // Use a map by notification_id since this mapping is the most often used. |
| 88 std::map<std::string, std::unique_ptr<ProfileNotification>> | 95 std::map<std::string, std::unique_ptr<ProfileNotification>> |
| 89 profile_notifications_; | 96 profile_notifications_; |
| 90 | 97 |
| 91 // Helpers that add/remove the notification from local map. | 98 // Helpers that add/remove the notification from local map. |
| 92 // The local map takes ownership of profile_notification object. | 99 // The local map takes ownership of profile_notification object. |
| 93 void AddProfileNotification( | 100 void AddProfileNotification( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 105 | 112 |
| 106 NotificationSystemObserver system_observer_; | 113 NotificationSystemObserver system_observer_; |
| 107 | 114 |
| 108 // Keeps track of all notification statistics for UMA purposes. | 115 // Keeps track of all notification statistics for UMA purposes. |
| 109 MessageCenterStatsCollector stats_collector_; | 116 MessageCenterStatsCollector stats_collector_; |
| 110 | 117 |
| 111 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); | 118 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); |
| 112 }; | 119 }; |
| 113 | 120 |
| 114 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 121 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |