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

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

Issue 10837013: Chrome Cloud Messaging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: InvalidationHandler + event Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/push_messaging/invalidation_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_INVALIDATION_HANDLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_INVALIDATION_HANDLER_H_
7
8 #include <map>
9 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "google/cacheinvalidation/include/types.h"
13 #include "sync/notifier/invalidation_util.h"
14 #include "sync/notifier/sync_notifier_observer.h"
15
16 namespace extensions {
17
18 class InvalidationHandlerObserver;
19
20 // Implements a listener for invalidations from Tango for app messaging.
21 // TODO(dcheng): Are there threading requirements here? We probably need to run
22 // on a certain thread.
23 // TODO(dcheng): This name is probably too generic.
24 class InvalidationHandler : public syncer::SyncNotifierObserver {
25 public:
26 explicit InvalidationHandler(InvalidationHandlerObserver* observer);
27 virtual ~InvalidationHandler();
28
29 void RegisterExtension(const std::string& id);
30 void UnregisterExtension(const std::string& id);
31
32 // SyncNotifierObserver implementation.
33 virtual void OnIncomingNotification(
34 const syncer::ObjectIdPayloadMap& id_payloads,
35 syncer::IncomingNotificationSource source) OVERRIDE;
36 virtual void OnNotificationsEnabled() OVERRIDE;
37 virtual void OnNotificationsDisabled(
38 syncer::NotificationsDisabledReason reason) OVERRIDE;
39
40 private:
41 struct InvalidationRecord {
42 // TODO(dcheng): Eventually we might store ack handles or something in here.
43 enum Status {
44 // TODO(dcheng): Better naming?
45 kUpToDate,
46 kNeedsAck,
47 };
48 Status status;
49 };
50 typedef std::map<invalidation::ObjectId,
51 InvalidationRecord,
52 syncer::ObjectIdLessThan> InvalidationRecordMap;
53
54 InvalidationHandlerObserver* observer_;
55 InvalidationRecordMap registered_entries_;
56
57 DISALLOW_COPY_AND_ASSIGN(InvalidationHandler);
58 };
59
60 } // namespace extensions
61
62 #endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_INVALIDATION_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/push_messaging/invalidation_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698