| Index: chrome/browser/notifications/desktop_notification_service.h
|
| ===================================================================
|
| --- chrome/browser/notifications/desktop_notification_service.h (revision 32803)
|
| +++ chrome/browser/notifications/desktop_notification_service.h (working copy)
|
| @@ -9,6 +9,8 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "chrome/browser/notifications/notification.h"
|
| +#include "chrome/common/notification_registrar.h"
|
| +#include "chrome/common/notification_service.h"
|
| #include "googleurl/src/gurl.h"
|
|
|
| class NotificationUIManager;
|
| @@ -19,16 +21,16 @@
|
|
|
| // The DesktopNotificationService is an object, owned by the Profile,
|
| // which provides the creation of desktop "toasts" to web pages and workers.
|
| -class DesktopNotificationService {
|
| +class DesktopNotificationService : public NotificationObserver {
|
| public:
|
| - enum NotificationSource {
|
| + enum DesktopNotificationSource {
|
| PageNotification,
|
| WorkerNotification
|
| };
|
|
|
| DesktopNotificationService(Profile* profile,
|
| NotificationUIManager* ui_manager);
|
| - ~DesktopNotificationService();
|
| + virtual ~DesktopNotificationService();
|
|
|
| // Requests permission (using an info-bar) for a given origin.
|
| // |callback_context| contains an opaque value to pass back to the
|
| @@ -49,11 +51,11 @@
|
| // value to be passed back to the process when events occur on
|
| // this notification.
|
| bool ShowDesktopNotification(const GURL& origin, const GURL& url,
|
| - int process_id, int route_id, NotificationSource source,
|
| + int process_id, int route_id, DesktopNotificationSource source,
|
| int notification_id);
|
| bool ShowDesktopNotificationText(const GURL& origin, const GURL& icon,
|
| const string16& title, const string16& text, int process_id,
|
| - int route_id, NotificationSource source, int notification_id);
|
| + int route_id, DesktopNotificationSource source, int notification_id);
|
|
|
| // Cancels a notification. If it has already been shown, it will be
|
| // removed from the screen. If it hasn't been shown yet, it won't be
|
| @@ -68,6 +70,11 @@
|
|
|
| NotificationsPrefsCache* prefs_cache() { return prefs_cache_; }
|
|
|
| + // NotificationObserver interface.
|
| + virtual void Observe(NotificationType type,
|
| + const NotificationSource& source,
|
| + const NotificationDetails& details);
|
| +
|
| private:
|
| void InitPrefs();
|
|
|
| @@ -87,6 +94,9 @@
|
| // UI for desktop toasts.
|
| NotificationUIManager* ui_manager_;
|
|
|
| + // Connection to the service providing the other kind of notifications.
|
| + NotificationRegistrar notification_registrar_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService);
|
| };
|
|
|
|
|