| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_COMMON_NOTIFICATION_REGISTRAR_H_ | 5 #ifndef CHROME_COMMON_NOTIFICATION_REGISTRAR_H_ |
| 6 #define CHROME_COMMON_NOTIFICATION_REGISTRAR_H_ | 6 #define CHROME_COMMON_NOTIFICATION_REGISTRAR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chrome/common/notification_observer.h" | 12 #include "chrome/common/notification_type.h" |
| 13 |
| 14 class NotificationObserver; |
| 15 class NotificationSource; |
| 13 | 16 |
| 14 // Aids in registering for notifications and ensures that all registered | 17 // Aids in registering for notifications and ensures that all registered |
| 15 // notifications are unregistered when the class is destroyed. | 18 // notifications are unregistered when the class is destroyed. |
| 16 // | 19 // |
| 17 // The intended use is that you make a NotificationRegistrar member in your | 20 // The intended use is that you make a NotificationRegistrar member in your |
| 18 // class and use it to register your notifications instead of going through the | 21 // class and use it to register your notifications instead of going through the |
| 19 // notification service directly. It will automatically unregister them for | 22 // notification service directly. It will automatically unregister them for |
| 20 // you. | 23 // you. |
| 21 class NotificationRegistrar { | 24 class NotificationRegistrar { |
| 22 public: | 25 public: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 // notifications anyway. | 51 // notifications anyway. |
| 49 typedef std::vector<Record> RecordVector; | 52 typedef std::vector<Record> RecordVector; |
| 50 | 53 |
| 51 // Lists all notifications we're currently registered for. | 54 // Lists all notifications we're currently registered for. |
| 52 RecordVector registered_; | 55 RecordVector registered_; |
| 53 | 56 |
| 54 DISALLOW_COPY_AND_ASSIGN(NotificationRegistrar); | 57 DISALLOW_COPY_AND_ASSIGN(NotificationRegistrar); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 #endif // CHROME_COMMON_NOTIFICATION_REGISTRAR_H_ | 60 #endif // CHROME_COMMON_NOTIFICATION_REGISTRAR_H_ |
| OLD | NEW |