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" | |
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 | |
19 namespace extensions { | |
20 | |
21 class PushMessagingInvalidationHandlerObserver; | |
Munjal (Google)
2012/08/14 18:56:37
I am wondering if we should have a browser/push_me
dcheng
2012/08/14 21:39:59
That seems like a good idea. The class names are r
| |
22 | |
23 // This class maps extension IDs to the corresponding object IDs, manages | |
24 // invalidation registrations, and dispatches callbacks for any invalidations | |
25 // received. | |
26 class PushMessagingInvalidationHandler : public PushMessagingInvalidationMapper, | |
27 public syncer::SyncNotifierObserver { | |
28 public: | |
29 // |service| and |observer| must remain valid for the lifetime of this object. | |
30 // |extension_ids| is the set of extension IDs for which push messaging is | |
31 // enabled. | |
32 PushMessagingInvalidationHandler( | |
33 InvalidationService* service, | |
34 PushMessagingInvalidationHandlerObserver* observer, | |
35 const std::set<std::string>& extension_ids); | |
36 virtual ~PushMessagingInvalidationHandler(); | |
37 | |
38 // PushMessagingInvalidationMapper implementation. | |
39 virtual void RegisterExtension(const std::string& extension_id) OVERRIDE; | |
40 virtual void UnregisterExtension(const std::string& extension_id) OVERRIDE; | |
41 | |
42 // SyncNotifierObserver implementation. | |
43 virtual void OnNotificationsEnabled() OVERRIDE; | |
44 virtual void OnNotificationsDisabled( | |
45 syncer::NotificationsDisabledReason reason) OVERRIDE; | |
46 virtual void OnIncomingNotification( | |
47 const syncer::ObjectIdPayloadMap& id_payloads, | |
48 syncer::IncomingNotificationSource source) OVERRIDE; | |
49 | |
50 private: | |
51 base::ThreadChecker thread_checker_; | |
52 InvalidationService* service_; | |
53 syncer::ObjectIdSet registered_ids_; | |
54 PushMessagingInvalidationHandlerObserver* observer_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(PushMessagingInvalidationHandler); | |
57 }; | |
58 | |
59 } // namespace extensions | |
60 | |
61 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDAT ION_HANDLER_H_ | |
OLD | NEW |