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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h

Issue 10875064: Rename SyncNotifier->Invalidator and SyncNotifierObserver->InvalidationHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to ToT for landing Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION _HANDLER_H_ 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_ 6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION _HANDLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_mapper.h" 14 #include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidati on_mapper.h"
15 #include "sync/notifier/sync_notifier_observer.h" 15 #include "sync/notifier/invalidation_handler.h"
16 16
17 class InvalidationFrontend; 17 class InvalidationFrontend;
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 class PushMessagingInvalidationHandlerDelegate; 21 class PushMessagingInvalidationHandlerDelegate;
22 22
23 // This class maps extension IDs to the corresponding object IDs, manages 23 // This class maps extension IDs to the corresponding object IDs, manages
24 // invalidation registrations, and dispatches callbacks for any invalidations 24 // invalidation registrations, and dispatches callbacks for any invalidations
25 // received. 25 // received.
26 class PushMessagingInvalidationHandler : public PushMessagingInvalidationMapper, 26 class PushMessagingInvalidationHandler : public PushMessagingInvalidationMapper,
27 public syncer::SyncNotifierObserver { 27 public syncer::InvalidationHandler {
28 public: 28 public:
29 // |service| and |delegate| must remain valid for the lifetime of this object. 29 // |service| and |delegate| must remain valid for the lifetime of this object.
30 // |extension_ids| is the set of extension IDs for which push messaging is 30 // |extension_ids| is the set of extension IDs for which push messaging is
31 // enabled. 31 // enabled.
32 PushMessagingInvalidationHandler( 32 PushMessagingInvalidationHandler(
33 InvalidationFrontend* service, 33 InvalidationFrontend* service,
34 PushMessagingInvalidationHandlerDelegate* delegate, 34 PushMessagingInvalidationHandlerDelegate* delegate,
35 const std::set<std::string>& extension_ids); 35 const std::set<std::string>& extension_ids);
36 virtual ~PushMessagingInvalidationHandler(); 36 virtual ~PushMessagingInvalidationHandler();
37 37
38 // PushMessagingInvalidationMapper implementation. 38 // PushMessagingInvalidationMapper implementation.
39 virtual void RegisterExtension(const std::string& extension_id) OVERRIDE; 39 virtual void RegisterExtension(const std::string& extension_id) OVERRIDE;
40 virtual void UnregisterExtension(const std::string& extension_id) OVERRIDE; 40 virtual void UnregisterExtension(const std::string& extension_id) OVERRIDE;
41 41
42 // SyncNotifierObserver implementation. 42 // InvalidationHandler implementation.
43 virtual void OnNotificationsEnabled() OVERRIDE; 43 virtual void OnNotificationsEnabled() OVERRIDE;
44 virtual void OnNotificationsDisabled( 44 virtual void OnNotificationsDisabled(
45 syncer::NotificationsDisabledReason reason) OVERRIDE; 45 syncer::NotificationsDisabledReason reason) OVERRIDE;
46 virtual void OnIncomingNotification( 46 virtual void OnIncomingNotification(
47 const syncer::ObjectIdStateMap& id_state_map, 47 const syncer::ObjectIdStateMap& id_state_map,
48 syncer::IncomingNotificationSource source) OVERRIDE; 48 syncer::IncomingNotificationSource source) OVERRIDE;
49 49
50 const std::set<std::string>& GetRegisteredExtensionsForTest() const { 50 const std::set<std::string>& GetRegisteredExtensionsForTest() const {
51 return registered_extensions_; 51 return registered_extensions_;
52 } 52 }
53 53
54 private: 54 private:
55 void UpdateRegistrations(); 55 void UpdateRegistrations();
56 56
57 base::ThreadChecker thread_checker_; 57 base::ThreadChecker thread_checker_;
58 InvalidationFrontend* const service_; 58 InvalidationFrontend* const service_;
59 std::set<std::string> registered_extensions_; 59 std::set<std::string> registered_extensions_;
60 PushMessagingInvalidationHandlerDelegate* const delegate_; 60 PushMessagingInvalidationHandlerDelegate* const delegate_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(PushMessagingInvalidationHandler); 62 DISALLOW_COPY_AND_ASSIGN(PushMessagingInvalidationHandler);
63 }; 63 };
64 64
65 } // namespace extensions 65 } // namespace extensions
66 66
67 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDAT ION_HANDLER_H_ 67 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDAT ION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698