Chromium Code Reviews| Index: chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h |
| diff --git a/chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h b/chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0427363b420cf19c90afd60655a5a285b55ca713 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_handler.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION_HANDLER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION_HANDLER_H_ |
| + |
| +#include <set> |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| +#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
|
| +#include "base/threading/thread_checker.h" |
| +#include "chrome/browser/extensions/api/push_messaging/push_messaging_invalidation_mapper.h" |
| +#include "sync/notifier/sync_notifier_observer.h" |
| + |
| +class InvalidationService; |
| + |
|
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
|
| +namespace extensions { |
| + |
| +class PushMessagingInvalidationHandlerObserver; |
| + |
| +// This class maps extension IDs to their corresponding object IDs, manages the |
| +// 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
|
| +class PushMessagingInvalidationHandler : public PushMessagingInvalidationMapper, |
| + public syncer::SyncNotifierObserver { |
| + public: |
| + // |extension_ids| is the set of extension IDs for which push messaging is |
| + // 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.
|
| + PushMessagingInvalidationHandler( |
| + InvalidationService* service, |
| + PushMessagingInvalidationHandlerObserver* observer, |
| + const std::set<std::string>& extension_ids); |
| + virtual ~PushMessagingInvalidationHandler(); |
| + |
| + // PushMessagingInvalidationMapper implementation. |
| + virtual void RegisterExtension(const std::string& extension_id) OVERRIDE; |
| + virtual void UnregisterExtension(const std::string& extension_id) OVERRIDE; |
| + |
| + // 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
|
| + virtual void OnNotificationsEnabled() OVERRIDE; |
| + virtual void OnNotificationsDisabled( |
| + syncer::NotificationsDisabledReason reason) OVERRIDE; |
| + virtual void OnIncomingNotification( |
| + const syncer::ObjectIdPayloadMap& id_payloads, |
| + syncer::IncomingNotificationSource source) OVERRIDE; |
| + |
| + private: |
| + base::ThreadChecker thread_checker_; |
| + InvalidationService* service_; |
| + syncer::ObjectIdSet registered_ids_; |
| + PushMessagingInvalidationHandlerObserver* observer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PushMessagingInvalidationHandler); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_PUSH_MESSAGING_PUSH_MESSAGING_INVALIDATION_HANDLER_H_ |