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

Unified Diff: chrome/browser/sync/glue/android_invalidator_bridge.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
« no previous file with comments | « no previous file | chrome/browser/sync/glue/android_invalidator_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/android_invalidator_bridge.h
diff --git a/chrome/browser/sync/glue/chrome_sync_notification_bridge.h b/chrome/browser/sync/glue/android_invalidator_bridge.h
similarity index 53%
rename from chrome/browser/sync/glue/chrome_sync_notification_bridge.h
rename to chrome/browser/sync/glue/android_invalidator_bridge.h
index 788303e7e538ee7d9a0dbf362cf7258d2343edc6..a297abfce1d4d7e289bcb519df6490001a1b283b 100644
--- a/chrome/browser/sync/glue/chrome_sync_notification_bridge.h
+++ b/chrome/browser/sync/glue/android_invalidator_bridge.h
@@ -2,15 +2,15 @@
// 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_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
-#define CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
+#ifndef CHROME_BROWSER_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_H_
+#define CHROME_BROWSER_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_H_
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
-#include "sync/notifier/invalidation_util.h"
+#include "sync/notifier/invalidator.h"
class Profile;
@@ -23,28 +23,38 @@ namespace browser_sync {
// A bridge that converts Chrome events on the UI thread to sync
// notifications on the sync task runner.
//
-// Listens to NOTIFICATION_SYNC_REFRESH_LOCAL and
-// NOTIFICATION_SYNC_REFRESH_REMOTE (on the UI thread) and triggers
-// each observer's OnIncomingNotification method on these
-// notifications (on the sync task runner).
-class ChromeSyncNotificationBridge : public content::NotificationObserver {
+// Listens to NOTIFICATION_SYNC_REFRESH_REMOTE (on the UI thread) and triggers
+// each observer's OnIncomingNotification method on these notifications (on the
+// sync task runner). Android clients receive invalidations through this
+// mechanism exclusively, hence the name.
+class AndroidInvalidatorBridge
+ : public content::NotificationObserver, syncer::Invalidator {
public:
// Must be created and destroyed on the UI thread.
- ChromeSyncNotificationBridge(
+ AndroidInvalidatorBridge(
const Profile* profile,
const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner);
- virtual ~ChromeSyncNotificationBridge();
+ virtual ~AndroidInvalidatorBridge();
// Must be called on the UI thread while the sync task runner is still
// around. No other member functions on the sync thread may be called after
// this is called.
void StopForShutdown();
- // Must be called on the sync task runner.
- void RegisterHandler(syncer::InvalidationHandler* handler);
- void UpdateRegisteredIds(syncer::InvalidationHandler* handler,
- const syncer::ObjectIdSet& ids);
- void UnregisterHandler(syncer::InvalidationHandler* handler);
+ // Invalidator implementation. Must be called on the sync task runner.
+ 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;
+
+ // The following members of the Invalidator interface are not applicable to
+ // this invalidator and are implemented as no-ops.
+ 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;
bool IsHandlerRegisteredForTest(
syncer::InvalidationHandler* handler) const;
@@ -71,4 +81,4 @@ class ChromeSyncNotificationBridge : public content::NotificationObserver {
} // namespace browser_sync
-#endif // CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
+#endif // CHROME_BROWSER_SYNC_GLUE_ANDROID_INVALIDATOR_BRIDGE_H_
« no previous file with comments | « no previous file | chrome/browser/sync/glue/android_invalidator_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698