| 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" |
| 20 #include "content/public/browser/notification_registrar.h" |
| 19 #include "ui/message_center/message_center.h" | 21 #include "ui/message_center/message_center.h" |
| 20 #include "ui/message_center/message_center_observer.h" | 22 #include "ui/message_center/message_center_observer.h" |
| 21 #include "ui/message_center/message_center_tray_delegate.h" | 23 #include "ui/message_center/message_center_tray_delegate.h" |
| 22 | 24 |
| 23 class MessageCenterSettingsController; | 25 class MessageCenterSettingsController; |
| 24 class Notification; | 26 class Notification; |
| 25 class PrefService; | 27 class PrefService; |
| 26 class Profile; | 28 class Profile; |
| 27 | 29 |
| 28 // This class extends NotificationUIManagerImpl and delegates actual display | 30 // This class extends NotificationUIManagerImpl and delegates actual display |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void DisplayFirstRunBalloon(); | 76 void DisplayFirstRunBalloon(); |
| 75 | 77 |
| 76 void SetFirstRunTimeoutForTest(base::TimeDelta timeout); | 78 void SetFirstRunTimeoutForTest(base::TimeDelta timeout); |
| 77 bool FirstRunTimerIsActive() const; | 79 bool FirstRunTimerIsActive() const; |
| 78 #endif | 80 #endif |
| 79 | 81 |
| 80 // Takes ownership of |delegate|. | 82 // Takes ownership of |delegate|. |
| 81 void SetMessageCenterTrayDelegateForTest( | 83 void SetMessageCenterTrayDelegateForTest( |
| 82 message_center::MessageCenterTrayDelegate* delegate); | 84 message_center::MessageCenterTrayDelegate* delegate); |
| 83 | 85 |
| 86 protected: |
| 87 // content::NotificationObserver override. |
| 88 virtual void Observe(int type, |
| 89 const content::NotificationSource& source, |
| 90 const content::NotificationDetails& details) OVERRIDE; |
| 91 |
| 84 private: | 92 private: |
| 85 class ImageDownloadsObserver { | 93 class ImageDownloadsObserver { |
| 86 public: | 94 public: |
| 87 virtual void OnDownloadsCompleted() = 0; | 95 virtual void OnDownloadsCompleted() = 0; |
| 88 }; | 96 }; |
| 89 | 97 |
| 90 typedef base::Callback<void(const gfx::Image&)> SetImageCallback; | 98 typedef base::Callback<void(const gfx::Image&)> SetImageCallback; |
| 91 class ImageDownloads | 99 class ImageDownloads |
| 92 : public base::SupportsWeakPtr<ImageDownloads> { | 100 : public base::SupportsWeakPtr<ImageDownloads> { |
| 93 public: | 101 public: |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // The first-run balloon will be shown |first_run_idle_timeout_| after all | 215 // The first-run balloon will be shown |first_run_idle_timeout_| after all |
| 208 // popups go away and the user has notifications in the message center. | 216 // popups go away and the user has notifications in the message center. |
| 209 base::TimeDelta first_run_idle_timeout_; | 217 base::TimeDelta first_run_idle_timeout_; |
| 210 | 218 |
| 211 // Provides weak pointers for the purpose of the first run timer. | 219 // Provides weak pointers for the purpose of the first run timer. |
| 212 base::WeakPtrFactory<MessageCenterNotificationManager> weak_factory_; | 220 base::WeakPtrFactory<MessageCenterNotificationManager> weak_factory_; |
| 213 #endif | 221 #endif |
| 214 | 222 |
| 215 scoped_ptr<MessageCenterSettingsController> settings_controller_; | 223 scoped_ptr<MessageCenterSettingsController> settings_controller_; |
| 216 | 224 |
| 225 // Registrar for the other kind of notifications (event signaling). |
| 226 content::NotificationRegistrar registrar_; |
| 227 |
| 217 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); | 228 DISALLOW_COPY_AND_ASSIGN(MessageCenterNotificationManager); |
| 218 }; | 229 }; |
| 219 | 230 |
| 220 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ | 231 #endif // CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |