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

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

Issue 2827014: Implemented initial version of server-issued notification client. (Closed)
Patch Set: Added DEPS 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..e3f67b166f8dd022e8e68b6901ea4a1210372099
--- /dev/null
+++ b/chrome/browser/sync/notifier/chrome_invalidation_client.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2010 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.
+//
+// A simple wrapper around invalidation::InvalidationClient that
+// handles all the startup/shutdown details and hookups.
+
+#ifndef CHROME_BROWSER_SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_
+#define CHROME_BROWSER_SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/non_thread_safe.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/sync/notifier/chrome_system_resources.h"
+#include "google/cacheinvalidation/invalidation-client.h"
+
+namespace buzz {
+class XmppClient;
+} // namespace
+
+namespace sync_notifier {
+
+class CacheInvalidationPacketHandler;
+
+// TODO(akalin): Hook this up to a NetworkChangeNotifier so we can
+// properly notify invalidation_client_.
+
+class ChromeInvalidationClient {
+ public:
+ ChromeInvalidationClient();
+
+ ~ChromeInvalidationClient();
+
+ // Does not take ownership of |listener| nor |xmpp_client|.
+ void Start(
+ const std::string& app_name,
+ invalidation::InvalidationListener* 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.
+
+ void Register(const invalidation::ObjectId& oid,
+ invalidation::RegistrationCallback* callback);
+
+ void Unregister(const invalidation::ObjectId& oid,
+ invalidation::RegistrationCallback* callback);
+
+ private:
+ NonThreadSafe non_thread_safe_;
+ ChromeSystemResources chrome_system_resources_;
+ scoped_ptr<invalidation::InvalidationClient> invalidation_client_;
+ scoped_ptr<CacheInvalidationPacketHandler>
+ cache_invalidation_packet_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient);
+};
+
+} // namespace sync_notifier
+
+#endif // CHROME_BROWSER_SYNC_NOTIFIER_CHROME_INVALIDATION_CLIENT_H_

Powered by Google App Engine
This is Rietveld 408576698