OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION _HANDLER_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION _HANDLER_H_ | |
7 | |
8 #include <set> | |
9 #include <string> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | |
Pete Williamson
2012/08/13 18:24:09
It's a bit scary that we need to have some compile
dcheng
2012/08/13 20:44:14
It is used for the OVERRIDE keyword. Since this is
| |
13 #include "base/threading/thread_checker.h" | |
14 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_mapper.h" | |
15 #include "sync/notifier/sync_notifier_observer.h" | |
16 | |
17 class InvalidationService; | |
18 | |
Pete Williamson
2012/08/13 18:24:09
It might be nice to replace the word Invalidations
dcheng
2012/08/13 20:44:14
Notification, Message, and Event are all a little
| |
19 namespace extensions { | |
20 | |
21 class PushMessagingInvalidationHandlerObserver; | |
22 | |
23 // This class maps extension IDs to their corresponding object IDs, manages the | |
24 // Tango registrations, and dispatches callbacks for any invalidations received. | |
akalin
2012/08/10 23:07:10
tango is an internal code name. maybe 'invalidati
dcheng
2012/08/13 20:44:14
Done. "tango" is mentioned in the google-cache-inv
| |
25 class PushMessagingInvalidationHandler : public PushMessagingInvalidationMapper, | |
26 public syncer::SyncNotifierObserver { | |
27 public: | |
28 // |extension_ids| is the set of extension IDs for which push messaging is | |
29 // enabled. | |
Pete Williamson
2012/08/13 18:24:09
It might be good to comment on the ownership of th
dcheng
2012/08/13 20:44:14
Done.
| |
30 PushMessagingInvalidationHandler( | |
31 InvalidationService* service, | |
32 PushMessagingInvalidationHandlerObserver* observer, | |
33 const std::set<std::string>& extension_ids); | |
34 virtual ~PushMessagingInvalidationHandler(); | |
35 | |
36 // PushMessagingInvalidationMapper implementation. | |
37 virtual void RegisterExtension(const std::string& extension_id) OVERRIDE; | |
38 virtual void UnregisterExtension(const std::string& extension_id) OVERRIDE; | |
39 | |
40 // SyncNotifierObserver implementation. | |
Pete Williamson
2012/08/13 18:24:09
A bit more comment here about what a SyncNotifierO
dcheng
2012/08/13 20:44:14
Usually the documentation for the interface lives
| |
41 virtual void OnNotificationsEnabled() OVERRIDE; | |
42 virtual void OnNotificationsDisabled( | |
43 syncer::NotificationsDisabledReason reason) OVERRIDE; | |
44 virtual void OnIncomingNotification( | |
45 const syncer::ObjectIdPayloadMap& id_payloads, | |
46 syncer::IncomingNotificationSource source) OVERRIDE; | |
47 | |
48 private: | |
49 base::ThreadChecker thread_checker_; | |
50 InvalidationService* service_; | |
51 syncer::ObjectIdSet registered_ids_; | |
52 PushMessagingInvalidationHandlerObserver* observer_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(PushMessagingInvalidationHandler); | |
55 }; | |
56 | |
57 } // namespace extensions | |
58 | |
59 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDAT ION_HANDLER_H_ | |
OLD | NEW |