diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-10 15:52:27 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-10 15:52:27 +0000 |
commit | 43211582b1fa8c69136385250e7b0446cf364b5c (patch) | |
tree | 655ab01543012b6fd5699dee8fab92876959b7d9 /content/common/notification_service.h | |
parent | d43970a7ceee5fc5433787b0f28b64234a4039f2 (diff) | |
download | chromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.zip chromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.tar.gz chromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.tar.bz2 |
Moving notification types which are chrome specific to a new header file chrome_notification_types.h.
This file lives in chrome\common. The chrome specific notifications start from NOTIFICATION_CONTENT_END
which defines the end of the enum used by content to define notification types. The notificaton_type.h file
in content\common has been renamed to content_notification_types.h
BUG=76698
Review URL: http://codereview.chromium.org/7327007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/notification_service.h')
-rw-r--r-- | content/common/notification_service.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/content/common/notification_service.h b/content/common/notification_service.h index 2b7ace8..c6898f5 100644 --- a/content/common/notification_service.h +++ b/content/common/notification_service.h @@ -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 @@ class NotificationService { // 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 @@ class NotificationService { 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 @@ class NotificationService { // 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 @@ class NotificationService { // // 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 @@ class NotificationService { // 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); |