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

Unified Diff: content/common/notification_service.h

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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
« no previous file with comments | « content/common/notification_registrar.cc ('k') | content/common/notification_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/notification_service.h
===================================================================
--- content/common/notification_service.h (revision 91968)
+++ content/common/notification_service.h (working copy)
@@ -13,9 +13,9 @@
#include <map>
#include "base/observer_list.h"
+#include "content/common/content_notification_types.h"
#include "content/common/notification_details.h"
#include "content/common/notification_source.h"
-#include "content/common/notification_type.h"
class NotificationObserver;
@@ -38,7 +38,7 @@
// Details is a reference to an object containing additional data about
// the notification. If no additional data is needed, NoDetails() is used.
// There is no particular order in which the observers will be notified.
- void Notify(NotificationType type,
+ void Notify(int type,
const NotificationSource& source,
const NotificationDetails& details);
@@ -55,6 +55,8 @@
typedef ObserverList<NotificationObserver> NotificationObserverList;
typedef std::map<uintptr_t, NotificationObserverList*> NotificationSourceMap;
+ typedef std::map<int, NotificationSourceMap> NotificationObserverMap;
+ typedef std::map<int, int> NotificationObserverCount;
// Convenience function to determine whether a source has a
// NotificationObserverList in the given map;
@@ -68,7 +70,8 @@
// notification is posted. Observer is a pointer to an object subclassing
// NotificationObserver to be notified when an event matching the other two
// parameters is posted to this service. Type is the type of events to be
- // notified about (or NotificationType::ALL to receive events of all types).
+ // notified about (or content::NOTIFICATION_ALL to receive events of all
+ // types).
// Source is a NotificationSource object (created using
// "Source<classname>(pointer)"), if this observer only wants to
// receive events from that object, or NotificationService::AllSources()
@@ -80,7 +83,7 @@
//
// The caller retains ownership of the object pointed to by observer.
void AddObserver(NotificationObserver* observer,
- NotificationType type, const NotificationSource& source);
+ int type, const NotificationSource& source);
// NOTE: Rather than using this directly, you should use a
// NotificationRegistrar.
@@ -89,17 +92,17 @@
// that match type and source. If no object matching the parameters is
// currently registered, this method is a no-op.
void RemoveObserver(NotificationObserver* observer,
- NotificationType type, const NotificationSource& source);
+ int type, const NotificationSource& source);
// Keeps track of the observers for each type of notification.
// Until we get a prohibitively large number of notification types,
// a simple array is probably the fastest way to dispatch.
- NotificationSourceMap observers_[NotificationType::NOTIFICATION_TYPE_COUNT];
+ NotificationObserverMap observers_;
#ifndef NDEBUG
// Used to check to see that AddObserver and RemoveObserver calls are
// balanced.
- int observer_counts_[NotificationType::NOTIFICATION_TYPE_COUNT];
+ NotificationObserverCount observer_counts_;
#endif
DISALLOW_COPY_AND_ASSIGN(NotificationService);
« no previous file with comments | « content/common/notification_registrar.cc ('k') | content/common/notification_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698