Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1444)

Side by Side Diff: content/common/notification_registrar.h

Issue 7800015: prune down content_dll change to just the CONTENT_EXPORTS (Closed)
Patch Set: update copyright headers, merge Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 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_COMMON_NOTIFICATION_REGISTRAR_H_ 5 #ifndef CONTENT_COMMON_NOTIFICATION_REGISTRAR_H_
6 #define CONTENT_COMMON_NOTIFICATION_REGISTRAR_H_ 6 #define CONTENT_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 "content/common/content_export.h"
12 #include "content/common/content_notification_types.h" 13 #include "content/common/content_notification_types.h"
13 14
14 class NotificationObserver; 15 class NotificationObserver;
15 class NotificationSource; 16 class NotificationSource;
16 17
17 // Aids in registering for notifications and ensures that all registered 18 // Aids in registering for notifications and ensures that all registered
18 // notifications are unregistered when the class is destroyed. 19 // notifications are unregistered when the class is destroyed.
19 // 20 //
20 // The intended use is that you make a NotificationRegistrar member in your 21 // The intended use is that you make a NotificationRegistrar member in your
21 // class and use it to register your notifications instead of going through the 22 // class and use it to register your notifications instead of going through the
22 // notification service directly. It will automatically unregister them for 23 // notification service directly. It will automatically unregister them for
23 // you. 24 // you.
24 class NotificationRegistrar { 25 class CONTENT_EXPORT NotificationRegistrar {
25 public: 26 public:
26 // This class must not be derived from (we don't have a virtual destructor so 27 // This class must not be derived from (we don't have a virtual destructor so
27 // it won't work). Instead, use it as a member in your class. 28 // it won't work). Instead, use it as a member in your class.
28 NotificationRegistrar(); 29 NotificationRegistrar();
29 ~NotificationRegistrar(); 30 ~NotificationRegistrar();
30 31
31 // Wrappers around NotificationService::[Add|Remove]Observer. 32 // Wrappers around NotificationService::[Add|Remove]Observer.
32 void Add(NotificationObserver* observer, 33 void Add(NotificationObserver* observer,
33 int type, 34 int type,
34 const NotificationSource& source); 35 const NotificationSource& source);
(...skipping 22 matching lines...) Expand all
57 // notifications anyway. 58 // notifications anyway.
58 typedef std::vector<Record> RecordVector; 59 typedef std::vector<Record> RecordVector;
59 60
60 // Lists all notifications we're currently registered for. 61 // Lists all notifications we're currently registered for.
61 RecordVector registered_; 62 RecordVector registered_;
62 63
63 DISALLOW_COPY_AND_ASSIGN(NotificationRegistrar); 64 DISALLOW_COPY_AND_ASSIGN(NotificationRegistrar);
64 }; 65 };
65 66
66 #endif // CONTENT_COMMON_NOTIFICATION_REGISTRAR_H_ 67 #endif // CONTENT_COMMON_NOTIFICATION_REGISTRAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698