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 <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/notifications/notification.h" | 12 #include "chrome/browser/notifications/notification.h" |
13 #include "chrome/browser/notifications/notification_ui_manager.h" | 13 #include "chrome/browser/notifications/notification_ui_manager.h" |
14 #include "chrome/browser/notifications/notification_ui_manager_impl.h" | 14 #include "chrome/browser/notifications/notification_ui_manager_impl.h" |
15 #include "ui/message_center/message_center.h" | 15 #include "ui/message_center/message_center.h" |
| 16 #include "ui/message_center/message_center_tray.h" |
16 | 17 |
17 class Notification; | 18 class Notification; |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 // This class extends NotificationUIManagerImpl and delegates actual display | 21 // This class extends NotificationUIManagerImpl and delegates actual display |
21 // of notifications to MessageCenter, doing necessary conversions. | 22 // of notifications to MessageCenter, doing necessary conversions. |
22 class MessageCenterNotificationManager | 23 class MessageCenterNotificationManager |
23 : public NotificationUIManagerImpl, | 24 : public NotificationUIManagerImpl, |
24 public message_center::MessageCenter::Delegate { | 25 public message_center::MessageCenter::Delegate { |
25 public: | 26 public: |
(...skipping 17 matching lines...) Expand all Loading... |
43 virtual void NotificationRemoved(const std::string& notification_id) OVERRIDE; | 44 virtual void NotificationRemoved(const std::string& notification_id) OVERRIDE; |
44 virtual void DisableExtension(const std::string& notification_id) OVERRIDE; | 45 virtual void DisableExtension(const std::string& notification_id) OVERRIDE; |
45 virtual void DisableNotificationsFromSource( | 46 virtual void DisableNotificationsFromSource( |
46 const std::string& notification_id) OVERRIDE; | 47 const std::string& notification_id) OVERRIDE; |
47 virtual void ShowSettings(const std::string& notification_id) OVERRIDE; | 48 virtual void ShowSettings(const std::string& notification_id) OVERRIDE; |
48 virtual void OnClicked(const std::string& notification_id) OVERRIDE; | 49 virtual void OnClicked(const std::string& notification_id) OVERRIDE; |
49 virtual void OnButtonClicked(const std::string& notification_id, | 50 virtual void OnButtonClicked(const std::string& notification_id, |
50 int button_index) OVERRIDE; | 51 int button_index) OVERRIDE; |
51 | 52 |
52 private: | 53 private: |
| 54 scoped_ptr<ui::MessageCenterTrayDelegate> tray_; |
53 message_center::MessageCenter* message_center_; // Weak, global. | 55 message_center::MessageCenter* message_center_; // Weak, global. |
54 | 56 |
55 // This class keeps a set of original Notification objects and corresponding | 57 // This class keeps a set of original Notification objects and corresponding |
56 // Profiles, so when MessageCenter calls back with a notification_id, this | 58 // Profiles, so when MessageCenter calls back with a notification_id, this |
57 // class has necessary mapping to other source info - for example, it calls | 59 // class has necessary mapping to other source info - for example, it calls |
58 // NotificationDelegate supplied by client when someone clicks on a Notification | 60 // NotificationDelegate supplied by client when someone clicks on a Notification |
59 // in MessageCenter. Likewise, if a Profile or Extension is being removed, the | 61 // in MessageCenter. Likewise, if a Profile or Extension is being removed, the |
60 // map makes it possible to revoke the notifications from MessageCenter. | 62 // map makes it possible to revoke the notifications from MessageCenter. |
61 // To keep that set, we use the private ProfileNotification class that stores | 63 // To keep that set, we use the private ProfileNotification class that stores |
62 // a superset of all information about a notification. | 64 // a superset of all information about a notification. |
(...skipping 25 matching lines...) Expand all Loading... |
88 // They take ownership of profile_notification object. | 90 // They take ownership of profile_notification object. |
89 void AddProfileNotification(ProfileNotification* profile_notification); | 91 void AddProfileNotification(ProfileNotification* profile_notification); |
90 void RemoveProfileNotification(ProfileNotification* profile_notification); | 92 void RemoveProfileNotification(ProfileNotification* profile_notification); |
91 | 93 |
92 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); | 94 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); |
93 }; | 95 }; |
94 | 96 |
95 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 97 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
96 | 98 |
97 | 99 |
OLD | NEW |