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

Unified Diff: chrome/browser/sync/notifier/chrome_invalidation_client.h

Issue 2817037: Refactored ChromeInvalidationClient to have its own listener type. (Closed)
Patch Set: Addressed nick's comments Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/sync/notifier/chrome_invalidation_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/notifier/chrome_invalidation_client.h
diff --git a/chrome/browser/sync/notifier/chrome_invalidation_client.h b/chrome/browser/sync/notifier/chrome_invalidation_client.h
index be71814b55b6f8a37229331d41fc5c03620b604c..e227fcc893d40e0fc7deb512fbb05388e25c22fb 100644
--- a/chrome/browser/sync/notifier/chrome_invalidation_client.h
+++ b/chrome/browser/sync/notifier/chrome_invalidation_client.h
@@ -14,6 +14,7 @@
#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/sync/notifier/chrome_system_resources.h"
+#include "chrome/browser/sync/syncable/model_type.h"
#include "google/cacheinvalidation/invalidation-client.h"
namespace buzz {
@@ -27,36 +28,58 @@ class CacheInvalidationPacketHandler;
// TODO(akalin): Hook this up to a NetworkChangeNotifier so we can
// properly notify invalidation_client_.
-class ChromeInvalidationClient {
+class ChromeInvalidationClient : public invalidation::InvalidationListener {
public:
+ class Listener {
+ public:
+ virtual ~Listener();
+
+ virtual void OnInvalidate(syncable::ModelType model_type) = 0;
+
+ virtual void OnInvalidateAll() = 0;
+ };
+
ChromeInvalidationClient();
- ~ChromeInvalidationClient();
+ // Calls Stop().
+ virtual ~ChromeInvalidationClient();
// Does not take ownership of |listener| nor |xmpp_client|.
void Start(
- const std::string& client_id,
- invalidation::InvalidationListener* listener,
+ const std::string& client_id, Listener* listener,
buzz::XmppClient* xmpp_client);
void Stop();
- // The following functions must only be called between calls to
- // Start() and Stop(). See invalidation-client.h for documentation.
+ // Register the sync types that we're interested in getting
+ // notifications for. Must only be called between calls to Start()
+ // and Stop().
+ void RegisterTypes();
+
+ // invalidation::InvalidationListener implementation.
+ //
+ // TODO(akalin): Move these into a private inner class.
- void Register(const invalidation::ObjectId& oid,
- invalidation::RegistrationCallback* callback);
+ virtual void Invalidate(const invalidation::Invalidation& invalidation,
+ invalidation::Closure* callback);
- void Unregister(const invalidation::ObjectId& oid,
- invalidation::RegistrationCallback* callback);
+ virtual void InvalidateAll(invalidation::Closure* callback);
+
+ virtual void AllRegistrationsLost(invalidation::Closure* callback);
+
+ virtual void RegistrationLost(const invalidation::ObjectId& object_id,
+ invalidation::Closure* callback);
private:
NonThreadSafe non_thread_safe_;
ChromeSystemResources chrome_system_resources_;
+ Listener* listener_;
scoped_ptr<invalidation::InvalidationClient> invalidation_client_;
scoped_ptr<CacheInvalidationPacketHandler>
cache_invalidation_packet_handler_;
+ void OnRegister(const invalidation::RegistrationUpdateResult& result);
+
DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient);
};
« no previous file with comments | « no previous file | chrome/browser/sync/notifier/chrome_invalidation_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698