| 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/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/prefs/pref_member.h" | 13 #include "base/prefs/pref_member.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "chrome/browser/notifications/notification.h" | 16 #include "chrome/browser/notifications/notification.h" |
| 17 #include "chrome/browser/notifications/notification_ui_manager.h" | 17 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 18 #include "chrome/browser/notifications/notification_ui_manager_impl.h" | 18 #include "chrome/browser/notifications/notification_ui_manager_impl.h" |
| 19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "ui/message_center/message_center.h" | 21 #include "ui/message_center/message_center.h" |
| 22 #include "ui/message_center/message_center_observer.h" | 22 #include "ui/message_center/message_center_observer.h" |
| 23 #include "ui/message_center/message_center_tray_delegate.h" | 23 #include "ui/message_center/message_center_tray_delegate.h" |
| 24 #include "ui/message_center/message_center_types.h" |
| 24 | 25 |
| 25 class MessageCenterSettingsController; | 26 class MessageCenterSettingsController; |
| 26 class Notification; | 27 class Notification; |
| 27 class PrefService; | 28 class PrefService; |
| 28 class Profile; | 29 class Profile; |
| 29 | 30 |
| 30 // This class extends NotificationUIManagerImpl and delegates actual display | 31 // This class extends NotificationUIManagerImpl and delegates actual display |
| 31 // of notifications to MessageCenter, doing necessary conversions. | 32 // of notifications to MessageCenter, doing necessary conversions. |
| 32 class MessageCenterNotificationManager | 33 class MessageCenterNotificationManager |
| 33 : public NotificationUIManagerImpl, | 34 : public NotificationUIManagerImpl, |
| 34 public message_center::MessageCenter::Delegate, | |
| 35 public message_center::MessageCenterObserver { | 35 public message_center::MessageCenterObserver { |
| 36 public: | 36 public: |
| 37 MessageCenterNotificationManager( | 37 MessageCenterNotificationManager( |
| 38 message_center::MessageCenter* message_center, | 38 message_center::MessageCenter* message_center, |
| 39 PrefService* local_state, | 39 PrefService* local_state, |
| 40 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider); | 40 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider); |
| 41 virtual ~MessageCenterNotificationManager(); | 41 virtual ~MessageCenterNotificationManager(); |
| 42 | 42 |
| 43 // NotificationUIManager | 43 // NotificationUIManager |
| 44 virtual const Notification* FindById( | 44 virtual const Notification* FindById( |
| 45 const std::string& notification_id) const OVERRIDE; | 45 const std::string& notification_id) const OVERRIDE; |
| 46 virtual bool CancelById(const std::string& notification_id) OVERRIDE; | 46 virtual bool CancelById(const std::string& notification_id) OVERRIDE; |
| 47 virtual std::set<std::string> GetAllIdsByProfileAndSourceOrigin( | 47 virtual std::set<std::string> GetAllIdsByProfileAndSourceOrigin( |
| 48 Profile* profile, | 48 Profile* profile, |
| 49 const GURL& source) OVERRIDE; | 49 const GURL& source) OVERRIDE; |
| 50 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) OVERRIDE; | 50 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) OVERRIDE; |
| 51 virtual bool CancelAllByProfile(Profile* profile) OVERRIDE; | 51 virtual bool CancelAllByProfile(Profile* profile) OVERRIDE; |
| 52 virtual void CancelAll() OVERRIDE; | 52 virtual void CancelAll() OVERRIDE; |
| 53 | 53 |
| 54 // NotificationUIManagerImpl | 54 // NotificationUIManagerImpl |
| 55 virtual bool ShowNotification(const Notification& notification, | 55 virtual bool ShowNotification(const Notification& notification, |
| 56 Profile* profile) OVERRIDE; | 56 Profile* profile) OVERRIDE; |
| 57 virtual bool UpdateNotification(const Notification& notification, | 57 virtual bool UpdateNotification(const Notification& notification, |
| 58 Profile* profile) OVERRIDE; | 58 Profile* profile) OVERRIDE; |
| 59 | 59 |
| 60 // MessageCenter::Delegate | |
| 61 virtual void ShowSettings(const std::string& notification_id) OVERRIDE; | |
| 62 | |
| 63 // MessageCenterObserver | 60 // MessageCenterObserver |
| 64 virtual void OnNotificationRemoved(const std::string& notification_id, | 61 virtual void OnNotificationRemoved(const std::string& notification_id, |
| 65 bool by_user) OVERRIDE; | 62 bool by_user) OVERRIDE; |
| 66 virtual void OnNotificationCenterClosed() OVERRIDE; | 63 virtual void OnCenterVisibilityChanged(message_center::Visibility) OVERRIDE; |
| 67 virtual void OnNotificationUpdated(const std::string& notification_id) | 64 virtual void OnNotificationUpdated(const std::string& notification_id) |
| 68 OVERRIDE; | 65 OVERRIDE; |
| 69 | 66 |
| 70 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
| 71 // Called when the pref changes for the first run balloon. The first run | 68 // Called when the pref changes for the first run balloon. The first run |
| 72 // balloon is only displayed on Windows, since the visibility of the tray | 69 // balloon is only displayed on Windows, since the visibility of the tray |
| 73 // icon is limited. | 70 // icon is limited. |
| 74 void DisplayFirstRunBalloon(); | 71 void DisplayFirstRunBalloon(); |
| 75 | 72 |
| 76 void SetFirstRunTimeoutForTest(base::TimeDelta timeout); | 73 void SetFirstRunTimeoutForTest(base::TimeDelta timeout); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 216 |
| 220 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider_; | 217 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider_; |
| 221 | 218 |
| 222 // Registrar for the other kind of notifications (event signaling). | 219 // Registrar for the other kind of notifications (event signaling). |
| 223 content::NotificationRegistrar registrar_; | 220 content::NotificationRegistrar registrar_; |
| 224 | 221 |
| 225 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); | 222 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); |
| 226 }; | 223 }; |
| 227 | 224 |
| 228 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 225 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |