[Invalidations] Add GetInvalidatorState() to Invalidator{,Frontend}
Combine OnNotifications{Enabled,Disabled}() into OnInvalidatorStateChange(). Replace NotificationsDisabledReason with InvalidatorState.
Rename OnIncomingNotification to OnIncomingInvalidation. Also change
some references of "notification" to "invalidation".
Set the initial invalidator state in ChromeToMobileService. Also remove OnNotificationsEnabled() call from OnIncomingInvalidation().
Instantiate InvalidatorTest template for ProfileSyncService.
Move comments for invalidation-related functions from ProfileSyncService to InvalidatorFrontend.
Put DISALLOW_COPY_AND_ASSIGN on some classes.
Fix comment in invalidator.h.
BUG=142475
[email protected]
Review URL: https://chromiumcodereview.appspot.com/10916131
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155448 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/sync/notifier/invalidation_handler.h b/sync/notifier/invalidation_handler.h
index c1252ac..58f3a53 100644
--- a/sync/notifier/invalidation_handler.h
+++ b/sync/notifier/invalidation_handler.h
@@ -5,33 +5,29 @@
#ifndef SYNC_NOTIFIER_INVALIDATION_HANDLER_H_
#define SYNC_NOTIFIER_INVALIDATION_HANDLER_H_
+#include "sync/notifier/invalidator_state.h"
#include "sync/notifier/object_id_state_map.h"
-#include "sync/notifier/notifications_disabled_reason.h"
namespace syncer {
-enum IncomingNotificationSource {
- // The server is notifying us that one or more datatypes have stale data.
- REMOTE_NOTIFICATION,
- // A chrome datatype is requesting an optimistic refresh of its data.
- LOCAL_NOTIFICATION,
+enum IncomingInvalidationSource {
+ // The server is notifying us that one or more objects have stale data.
+ REMOTE_INVALIDATION,
+ // Something locally is requesting an optimistic refresh of its data.
+ LOCAL_INVALIDATION,
};
class InvalidationHandler {
public:
- // Called when notifications are enabled.
- virtual void OnNotificationsEnabled() = 0;
+ // Called when the invalidator state changes.
+ virtual void OnInvalidatorStateChange(InvalidatorState state) = 0;
- // Called when notifications are disabled, with the reason in
- // |reason|.
- virtual void OnNotificationsDisabled(
- NotificationsDisabledReason reason) = 0;
-
- // Called when a notification is received. The per-id states
- // are in |id_state_map| and the source is in |source|.
- virtual void OnIncomingNotification(
+ // Called when a invalidation is received. The per-id states are in
+ // |id_state_map| and the source is in |source|. Note that this may be
+ // called regardless of the current invalidator state.
+ virtual void OnIncomingInvalidation(
const ObjectIdStateMap& id_state_map,
- IncomingNotificationSource source) = 0;
+ IncomingInvalidationSource source) = 0;
protected:
virtual ~InvalidationHandler() {}