OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_IMPL_H_ |
6 #define CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_IMPL_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 static NotificationServiceImpl* current(); | 23 static NotificationServiceImpl* current(); |
24 | 24 |
25 // Normally instantiated when the thread is created. Not all threads have | 25 // Normally instantiated when the thread is created. Not all threads have |
26 // a NotificationService. Only one instance should be created per thread. | 26 // a NotificationService. Only one instance should be created per thread. |
27 NotificationServiceImpl(); | 27 NotificationServiceImpl(); |
28 virtual ~NotificationServiceImpl(); | 28 virtual ~NotificationServiceImpl(); |
29 | 29 |
30 // content::NotificationService | 30 // content::NotificationService |
31 virtual void Notify(int type, | 31 virtual void Notify(int type, |
32 const content::NotificationSource& source, | 32 const content::NotificationSource& source, |
33 const content::NotificationDetails& details); | 33 const content::NotificationDetails& details) OVERRIDE; |
34 | 34 |
35 private: | 35 private: |
36 friend class content::NotificationRegistrar; | 36 friend class content::NotificationRegistrar; |
37 | 37 |
38 typedef ObserverList<content::NotificationObserver> NotificationObserverList; | 38 typedef ObserverList<content::NotificationObserver> NotificationObserverList; |
39 typedef std::map<uintptr_t, NotificationObserverList*> NotificationSourceMap; | 39 typedef std::map<uintptr_t, NotificationObserverList*> NotificationSourceMap; |
40 typedef std::map<int, NotificationSourceMap> NotificationObserverMap; | 40 typedef std::map<int, NotificationSourceMap> NotificationObserverMap; |
41 typedef std::map<int, int> NotificationObserverCount; | 41 typedef std::map<int, int> NotificationObserverCount; |
42 | 42 |
43 // Convenience function to determine whether a source has a | 43 // Convenience function to determine whether a source has a |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #ifndef NDEBUG | 84 #ifndef NDEBUG |
85 // Used to check to see that AddObserver and RemoveObserver calls are | 85 // Used to check to see that AddObserver and RemoveObserver calls are |
86 // balanced. | 86 // balanced. |
87 NotificationObserverCount observer_counts_; | 87 NotificationObserverCount observer_counts_; |
88 #endif | 88 #endif |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(NotificationServiceImpl); | 90 DISALLOW_COPY_AND_ASSIGN(NotificationServiceImpl); |
91 }; | 91 }; |
92 | 92 |
93 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_IMPL_H_ | 93 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_SERVICE_IMPL_H_ |
OLD | NEW |