| 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 // This file describes a central switchboard for notifications that might | 5 // This file describes a central switchboard for notifications that might |
| 6 // happen in various parts of the application, and allows users to register | 6 // happen in various parts of the application, and allows users to register |
| 7 // observers for various classes of events that they're interested in. | 7 // observers for various classes of events that they're interested in. |
| 8 | 8 |
| 9 #ifndef CONTENT_COMMON_NOTIFICATION_SERVICE_H_ | 9 #ifndef CONTENT_COMMON_NOTIFICATION_SERVICE_H_ |
| 10 #define CONTENT_COMMON_NOTIFICATION_SERVICE_H_ | 10 #define CONTENT_COMMON_NOTIFICATION_SERVICE_H_ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const NotificationSource& source, | 42 const NotificationSource& source, |
| 43 const NotificationDetails& details); | 43 const NotificationDetails& details); |
| 44 | 44 |
| 45 // Returns a NotificationSource that represents all notification sources | 45 // Returns a NotificationSource that represents all notification sources |
| 46 // (for the purpose of registering an observer for events from all sources). | 46 // (for the purpose of registering an observer for events from all sources). |
| 47 static Source<void> AllSources() { return Source<void>(NULL); } | 47 static Source<void> AllSources() { return Source<void>(NULL); } |
| 48 | 48 |
| 49 // Returns the same value as AllSources(). This function has semantic | 49 // Returns the same value as AllSources(). This function has semantic |
| 50 // differences to the programmer: We have checked that this AllSources() | 50 // differences to the programmer: We have checked that this AllSources() |
| 51 // usage is safe in the face of multiple profiles. Objects that were | 51 // usage is safe in the face of multiple profiles. Objects that were |
| 52 // singletons now will always have multiple instances, one per profile. | 52 // singletons now will always have multiple instances, one per browser |
| 53 // context. |
| 53 // | 54 // |
| 54 // Some usage is safe, where the Source is checked to see if it's a member of | 55 // Some usage is safe, where the Source is checked to see if it's a member of |
| 55 // a container before use. But, we want the number of AllSources() calls to | 56 // a container before use. But, we want the number of AllSources() calls to |
| 56 // drop to almost nothing, because most usages are not multiprofile safe and | 57 // drop to almost nothing, because most usages are not multiprofile safe and |
| 57 // were done because it was easier to listen to everything. | 58 // were done because it was easier to listen to everything. |
| 58 static Source<void> AllBrowserContextsAndSources() { | 59 static Source<void> AllBrowserContextsAndSources() { |
| 59 return Source<void>(NULL); | 60 return Source<void>(NULL); |
| 60 } | 61 } |
| 61 | 62 |
| 62 // Returns a NotificationDetails object that represents a lack of details | 63 // Returns a NotificationDetails object that represents a lack of details |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 #ifndef NDEBUG | 116 #ifndef NDEBUG |
| 116 // Used to check to see that AddObserver and RemoveObserver calls are | 117 // Used to check to see that AddObserver and RemoveObserver calls are |
| 117 // balanced. | 118 // balanced. |
| 118 NotificationObserverCount observer_counts_; | 119 NotificationObserverCount observer_counts_; |
| 119 #endif | 120 #endif |
| 120 | 121 |
| 121 DISALLOW_COPY_AND_ASSIGN(NotificationService); | 122 DISALLOW_COPY_AND_ASSIGN(NotificationService); |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 #endif // CONTENT_COMMON_NOTIFICATION_SERVICE_H_ | 125 #endif // CONTENT_COMMON_NOTIFICATION_SERVICE_H_ |
| OLD | NEW |