Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: chrome/browser/notifications/desktop_notification_service.h

Issue 432005: Make notifications permission available in the extension manifest and hook up... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};

Powered by Google App Engine
This is Rietveld 408576698