| 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 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // This class extends NotificationUIManagerImpl and delegates actual display | 38 // This class extends NotificationUIManagerImpl and delegates actual display |
| 39 // of notifications to MessageCenter, doing necessary conversions. | 39 // of notifications to MessageCenter, doing necessary conversions. |
| 40 class MessageCenterNotificationManager | 40 class MessageCenterNotificationManager |
| 41 : public NotificationUIManager, | 41 : public NotificationUIManager, |
| 42 public message_center::MessageCenterObserver { | 42 public message_center::MessageCenterObserver { |
| 43 public: | 43 public: |
| 44 MessageCenterNotificationManager( | 44 MessageCenterNotificationManager( |
| 45 message_center::MessageCenter* message_center, | 45 message_center::MessageCenter* message_center, |
| 46 PrefService* local_state, | 46 PrefService* local_state, |
| 47 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider); | 47 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider); |
| 48 virtual ~MessageCenterNotificationManager(); | 48 ~MessageCenterNotificationManager() override; |
| 49 | 49 |
| 50 // Registers preferences. | 50 // Registers preferences. |
| 51 static void RegisterPrefs(PrefRegistrySimple* registry); | 51 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 52 | 52 |
| 53 // NotificationUIManager | 53 // NotificationUIManager |
| 54 virtual void Add(const Notification& notification, | 54 void Add(const Notification& notification, Profile* profile) override; |
| 55 Profile* profile) override; | 55 bool Update(const Notification& notification, Profile* profile) override; |
| 56 virtual bool Update(const Notification& notification, | 56 const Notification* FindById(const std::string& delegate_id, |
| 57 Profile* profile) override; | 57 ProfileID profile_id) const override; |
| 58 virtual const Notification* FindById(const std::string& delegate_id, | 58 bool CancelById(const std::string& delegate_id, |
| 59 ProfileID profile_id) const override; | 59 ProfileID profile_id) override; |
| 60 virtual bool CancelById(const std::string& delegate_id, | 60 std::set<std::string> GetAllIdsByProfileAndSourceOrigin( |
| 61 ProfileID profile_id) override; | |
| 62 virtual std::set<std::string> GetAllIdsByProfileAndSourceOrigin( | |
| 63 Profile* profile, | 61 Profile* profile, |
| 64 const GURL& source) override; | 62 const GURL& source) override; |
| 65 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) override; | 63 bool CancelAllBySourceOrigin(const GURL& source_origin) override; |
| 66 virtual bool CancelAllByProfile(ProfileID profile_id) override; | 64 bool CancelAllByProfile(ProfileID profile_id) override; |
| 67 virtual void CancelAll() override; | 65 void CancelAll() override; |
| 68 | 66 |
| 69 // MessageCenterObserver | 67 // MessageCenterObserver |
| 70 virtual void OnNotificationRemoved(const std::string& notification_id, | 68 void OnNotificationRemoved(const std::string& notification_id, |
| 71 bool by_user) override; | 69 bool by_user) override; |
| 72 virtual void OnCenterVisibilityChanged(message_center::Visibility) override; | 70 void OnCenterVisibilityChanged(message_center::Visibility) override; |
| 73 virtual void OnNotificationUpdated(const std::string& notification_id) | 71 void OnNotificationUpdated(const std::string& notification_id) override; |
| 74 override; | |
| 75 | 72 |
| 76 void EnsureMessageCenterClosed(); | 73 void EnsureMessageCenterClosed(); |
| 77 | 74 |
| 78 #if defined(OS_WIN) | 75 #if defined(OS_WIN) |
| 79 // Called when the pref changes for the first run balloon. The first run | 76 // Called when the pref changes for the first run balloon. The first run |
| 80 // balloon is only displayed on Windows, since the visibility of the tray | 77 // balloon is only displayed on Windows, since the visibility of the tray |
| 81 // icon is limited. | 78 // icon is limited. |
| 82 void DisplayFirstRunBalloon(); | 79 void DisplayFirstRunBalloon(); |
| 83 | 80 |
| 84 void SetFirstRunTimeoutForTest(base::TimeDelta timeout); | 81 void SetFirstRunTimeoutForTest(base::TimeDelta timeout); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Keeps track of all notification statistics for UMA purposes. | 178 // Keeps track of all notification statistics for UMA purposes. |
| 182 MessageCenterStatsCollector stats_collector_; | 179 MessageCenterStatsCollector stats_collector_; |
| 183 | 180 |
| 184 // Keeps track of notifications specific to Google Now for UMA purposes. | 181 // Keeps track of notifications specific to Google Now for UMA purposes. |
| 185 GoogleNowNotificationStatsCollector google_now_stats_collector_; | 182 GoogleNowNotificationStatsCollector google_now_stats_collector_; |
| 186 | 183 |
| 187 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); | 184 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); |
| 188 }; | 185 }; |
| 189 | 186 |
| 190 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 187 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |