OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_COMMON_NOTIFICATION_SERVICE_H_ | 9 #ifndef CHROME_COMMON_NOTIFICATION_SERVICE_H_ |
10 #define CHROME_COMMON_NOTIFICATION_SERVICE_H_ | 10 #define CHROME_COMMON_NOTIFICATION_SERVICE_H_ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #include <map> | 13 #include <map> |
14 | 14 |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "chrome/common/notification_details.h" | 16 #include "chrome/common/notification_details.h" |
17 #include "chrome/common/notification_observer.h" | |
18 #include "chrome/common/notification_source.h" | 17 #include "chrome/common/notification_source.h" |
19 #include "chrome/common/notification_type.h" | 18 #include "chrome/common/notification_type.h" |
20 | 19 |
21 class NotificationObserver; | 20 class NotificationObserver; |
22 | 21 |
23 class NotificationService { | 22 class NotificationService { |
24 public: | 23 public: |
25 // Returns the NotificationService object for the current thread, or NULL if | 24 // Returns the NotificationService object for the current thread, or NULL if |
26 // none. | 25 // none. |
27 static NotificationService* current(); | 26 static NotificationService* current(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 #ifndef NDEBUG | 99 #ifndef NDEBUG |
101 // Used to check to see that AddObserver and RemoveObserver calls are | 100 // Used to check to see that AddObserver and RemoveObserver calls are |
102 // balanced. | 101 // balanced. |
103 int observer_counts_[NotificationType::NOTIFICATION_TYPE_COUNT]; | 102 int observer_counts_[NotificationType::NOTIFICATION_TYPE_COUNT]; |
104 #endif | 103 #endif |
105 | 104 |
106 DISALLOW_COPY_AND_ASSIGN(NotificationService); | 105 DISALLOW_COPY_AND_ASSIGN(NotificationService); |
107 }; | 106 }; |
108 | 107 |
109 #endif // CHROME_COMMON_NOTIFICATION_SERVICE_H_ | 108 #endif // CHROME_COMMON_NOTIFICATION_SERVICE_H_ |
OLD | NEW |