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

Unified Diff: chrome/browser/sync/glue/android_invalidator_bridge_proxy.h

Issue 12022041: Separate local and remote sync invalidations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 11 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/glue/android_invalidator_bridge_proxy.h
diff --git a/chrome/browser/sync/glue/android_invalidator_bridge_proxy.h b/chrome/browser/sync/glue/android_invalidator_bridge_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..0859e6f0fa85d090f4d8cca77228890e767f2adb
--- /dev/null
+++ b/chrome/browser/sync/glue/android_invalidator_bridge_proxy.h
@@ -0,0 +1,49 @@
+// 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_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_PROXY_H_
+#define CHROME_BROWSER_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_PROXY_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "sync/notifier/invalidator.h"
+
+namespace browser_sync {
+
+class AndroidInvalidatorBridge;
+
+// This class implements the Invalidator interface by wrapping (but not taking
+// ownership of) an AndroidInvalidatorBridge. This is useful because the
+// SyncManager currently expects to take ownership of its invalidator, but it is
+// not prepared to take ownership of the UI-thread-owned
+// AndroidInvalidatorBridge. So we use this class to wrap the
+// AndroidInvalidator and allow the SyncManager to own it instead.
+class AndroidInvalidatorBridgeProxy : public syncer::Invalidator {
+ public:
+ // Does not take ownership of |bridge|.
+ explicit AndroidInvalidatorBridgeProxy(AndroidInvalidatorBridge* bridge);
+ virtual ~AndroidInvalidatorBridgeProxy();
+
+ // Invalidator implementation. Passes through all calls to the bridge.
+ virtual void RegisterHandler(syncer::InvalidationHandler* handler) OVERRIDE;
+ virtual void UpdateRegisteredIds(syncer::InvalidationHandler * handler,
+ const syncer::ObjectIdSet& ids) OVERRIDE;
+ virtual void UnregisterHandler(syncer::InvalidationHandler* handler) OVERRIDE;
+ virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
+ virtual void SetUniqueId(const std::string& unique_id) OVERRIDE;
+ virtual void UpdateCredentials(
+ const std::string& email, const std::string& token) OVERRIDE;
+ virtual void SendInvalidation(
+ const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
+
+ private:
+ // The notification bridge that we forward to but don't own.
+ AndroidInvalidatorBridge* const bridge_;
+
+ DISALLOW_COPY_AND_ASSIGN(AndroidInvalidatorBridgeProxy);
+};
+
+} // namespace browser_sync
+
+#endif // CHROME_BROWSER_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_PROXY_H_
« no previous file with comments | « chrome/browser/sync/glue/android_invalidator_bridge.cc ('k') | chrome/browser/sync/glue/android_invalidator_bridge_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698