| 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 "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/prefs/pref_member.h" | 14 #include "base/prefs/pref_member.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "chrome/browser/notifications/message_center_stats_collector.h" | 17 #include "chrome/browser/notifications/message_center_stats_collector.h" |
| 18 #include "chrome/browser/notifications/notification.h" | 18 #include "chrome/browser/notifications/notification.h" |
| 19 #include "chrome/browser/notifications/notification_system_observer.h" | 19 #include "chrome/browser/notifications/notification_system_observer.h" |
| 20 #include "chrome/browser/notifications/notification_ui_manager.h" | 20 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 #include "ui/message_center/message_center.h" | 23 #include "ui/message_center/message_center.h" |
| 24 #include "ui/message_center/message_center_observer.h" | 24 #include "ui/message_center/message_center_observer.h" |
| 25 #include "ui/message_center/message_center_tray_delegate.h" | 25 #include "ui/message_center/message_center_tray_delegate.h" |
| 26 #include "ui/message_center/message_center_types.h" | 26 #include "ui/message_center/message_center_types.h" |
| 27 | 27 |
| 28 class MessageCenterSettingsController; | 28 class MessageCenterSettingsController; |
| 29 class Notification; | 29 class Notification; |
| 30 class PrefRegistrySimple; |
| 30 class PrefService; | 31 class PrefService; |
| 31 class Profile; | 32 class Profile; |
| 32 | 33 |
| 33 namespace message_center { | 34 namespace message_center { |
| 34 class NotificationBlocker; | 35 class NotificationBlocker; |
| 35 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManuallyCloseMessageCenter); | 36 FORWARD_DECLARE_TEST(WebNotificationTrayTest, ManuallyCloseMessageCenter); |
| 36 } | 37 } |
| 37 | 38 |
| 38 // This class extends NotificationUIManagerImpl and delegates actual display | 39 // This class extends NotificationUIManagerImpl and delegates actual display |
| 39 // of notifications to MessageCenter, doing necessary conversions. | 40 // of notifications to MessageCenter, doing necessary conversions. |
| 40 class MessageCenterNotificationManager | 41 class MessageCenterNotificationManager |
| 41 : public NotificationUIManager, | 42 : public NotificationUIManager, |
| 42 public message_center::MessageCenterObserver, | 43 public message_center::MessageCenterObserver, |
| 43 public content::NotificationObserver { | 44 public content::NotificationObserver { |
| 44 public: | 45 public: |
| 45 MessageCenterNotificationManager( | 46 MessageCenterNotificationManager( |
| 46 message_center::MessageCenter* message_center, | 47 message_center::MessageCenter* message_center, |
| 47 PrefService* local_state, | 48 PrefService* local_state, |
| 48 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider); | 49 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider); |
| 49 virtual ~MessageCenterNotificationManager(); | 50 virtual ~MessageCenterNotificationManager(); |
| 50 | 51 |
| 52 // Registers preferences. |
| 53 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 54 |
| 51 // NotificationUIManager | 55 // NotificationUIManager |
| 52 virtual void Add(const Notification& notification, | 56 virtual void Add(const Notification& notification, |
| 53 Profile* profile) OVERRIDE; | 57 Profile* profile) OVERRIDE; |
| 54 virtual bool Update(const Notification& notification, | 58 virtual bool Update(const Notification& notification, |
| 55 Profile* profile) OVERRIDE; | 59 Profile* profile) OVERRIDE; |
| 56 virtual const Notification* FindById( | 60 virtual const Notification* FindById( |
| 57 const std::string& notification_id) const OVERRIDE; | 61 const std::string& notification_id) const OVERRIDE; |
| 58 virtual bool CancelById(const std::string& notification_id) OVERRIDE; | 62 virtual bool CancelById(const std::string& notification_id) OVERRIDE; |
| 59 virtual std::set<std::string> GetAllIdsByProfileAndSourceOrigin( | 63 virtual std::set<std::string> GetAllIdsByProfileAndSourceOrigin( |
| 60 Profile* profile, | 64 Profile* profile, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 237 |
| 234 NotificationSystemObserver system_observer_; | 238 NotificationSystemObserver system_observer_; |
| 235 | 239 |
| 236 // Keeps track of all notification statistics for UMA purposes. | 240 // Keeps track of all notification statistics for UMA purposes. |
| 237 MessageCenterStatsCollector stats_collector_; | 241 MessageCenterStatsCollector stats_collector_; |
| 238 | 242 |
| 239 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); | 243 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); |
| 240 }; | 244 }; |
| 241 | 245 |
| 242 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 246 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |