summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorhaitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 01:04:08 +0000
committerhaitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 01:04:08 +0000
commitce7399ac8cb2355d80a71a3ac860b53fa15ff1f8 (patch)
treec7672724594566068416760c7cd32cb48e41da64 /sync
parent185fa85d78c5f8443faf455c10748cb7b0a4d4ed (diff)
downloadchromium_src-ce7399ac8cb2355d80a71a3ac860b53fa15ff1f8.zip
chromium_src-ce7399ac8cb2355d80a71a3ac860b53fa15ff1f8.tar.gz
chromium_src-ce7399ac8cb2355d80a71a3ac860b53fa15ff1f8.tar.bz2
Add an action for server to send down rollback command.
BUG=362679 Review URL: https://codereview.chromium.org/238273008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/engine/syncer_proto_util.cc8
-rw-r--r--sync/internal_api/public/util/syncer_error.cc1
-rw-r--r--sync/internal_api/public/util/syncer_error.h1
-rw-r--r--sync/protocol/proto_enum_conversions.cc1
-rw-r--r--sync/protocol/sync_enums.proto1
-rw-r--r--sync/protocol/sync_protocol_error.cc2
-rw-r--r--sync/protocol/sync_protocol_error.h6
7 files changed, 19 insertions, 1 deletions
diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc
index dab228f..fe2a875 100644
--- a/sync/engine/syncer_proto_util.cc
+++ b/sync/engine/syncer_proto_util.cc
@@ -122,6 +122,8 @@ SyncProtocolErrorType ConvertSyncProtocolErrorTypePBToLocalType(
return MIGRATION_DONE;
case sync_pb::SyncEnums::DISABLED_BY_ADMIN:
return DISABLED_BY_ADMIN;
+ case sync_pb::SyncEnums::USER_ROLLBACK:
+ return USER_ROLLBACK;
case sync_pb::SyncEnums::UNKNOWN:
return UNKNOWN_ERROR;
case sync_pb::SyncEnums::USER_NOT_ACTIVATED:
@@ -331,7 +333,9 @@ SyncProtocolError ConvertLegacyErrorCodeToNewError(
error.action = DISABLE_SYNC_ON_CLIENT;
} else if (error_type == sync_pb::SyncEnums::DISABLED_BY_ADMIN) {
error.action = STOP_SYNC_FOR_DISABLED_ACCOUNT;
- } // There is no other action we can compute for legacy server.
+ } else if (error_type == sync_pb::SyncEnums::USER_ROLLBACK) {
+ error.action = DISABLE_SYNC_AND_ROLLBACK;
+ } // There is no other action we can compute for legacy server.
return error;
}
@@ -467,6 +471,8 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage(
return SERVER_RETURN_NOT_MY_BIRTHDAY;
case DISABLED_BY_ADMIN:
return SERVER_RETURN_DISABLED_BY_ADMIN;
+ case USER_ROLLBACK:
+ return SERVER_RETURN_USER_ROLLBACK;
default:
NOTREACHED();
return UNSET;
diff --git a/sync/internal_api/public/util/syncer_error.cc b/sync/internal_api/public/util/syncer_error.cc
index 81805d2..8130b1e 100644
--- a/sync/internal_api/public/util/syncer_error.cc
+++ b/sync/internal_api/public/util/syncer_error.cc
@@ -27,6 +27,7 @@ const char* GetSyncerErrorString(SyncerError value) {
ENUM_CASE(SERVER_RETURN_CONFLICT);
ENUM_CASE(SERVER_RESPONSE_VALIDATION_FAILED);
ENUM_CASE(SERVER_RETURN_DISABLED_BY_ADMIN);
+ ENUM_CASE(SERVER_RETURN_USER_ROLLBACK);
ENUM_CASE(SERVER_MORE_TO_DOWNLOAD);
ENUM_CASE(DATATYPE_TRIGGERED_RETRY);
ENUM_CASE(SYNCER_OK);
diff --git a/sync/internal_api/public/util/syncer_error.h b/sync/internal_api/public/util/syncer_error.h
index 1a5ec79..05ad963 100644
--- a/sync/internal_api/public/util/syncer_error.h
+++ b/sync/internal_api/public/util/syncer_error.h
@@ -30,6 +30,7 @@ enum SYNC_EXPORT_PRIVATE SyncerError {
SERVER_RETURN_CONFLICT,
SERVER_RESPONSE_VALIDATION_FAILED,
SERVER_RETURN_DISABLED_BY_ADMIN,
+ SERVER_RETURN_USER_ROLLBACK,
// A datatype decided the sync cycle needed to be performed again.
DATATYPE_TRIGGERED_RETRY,
diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc
index edbe591..213a096 100644
--- a/sync/protocol/proto_enum_conversions.cc
+++ b/sync/protocol/proto_enum_conversions.cc
@@ -150,6 +150,7 @@ const char* GetErrorTypeString(sync_pb::SyncEnums::ErrorType error_type) {
ENUM_CASE(sync_pb::SyncEnums, TRANSIENT_ERROR);
ENUM_CASE(sync_pb::SyncEnums, MIGRATION_DONE);
ENUM_CASE(sync_pb::SyncEnums, DISABLED_BY_ADMIN);
+ ENUM_CASE(sync_pb::SyncEnums, USER_ROLLBACK);
ENUM_CASE(sync_pb::SyncEnums, UNKNOWN);
}
NOTREACHED();
diff --git a/sync/protocol/sync_enums.proto b/sync/protocol/sync_enums.proto
index 9305c67..6e1405b 100644
--- a/sync/protocol/sync_enums.proto
+++ b/sync/protocol/sync_enums.proto
@@ -98,6 +98,7 @@ message SyncEnums {
// these data types only and then re-sync with
// a server.
DISABLED_BY_ADMIN = 10; // An administrator disabled sync for this domain.
+ USER_ROLLBACK = 11; // Client told to stop syncing and roll back.
UNKNOWN = 100; // Unknown value. This should never be explicitly
// used; it is the default value when an
// out-of-date client parses a value it doesn't
diff --git a/sync/protocol/sync_protocol_error.cc b/sync/protocol/sync_protocol_error.cc
index cd22e9a..ac9e2fd 100644
--- a/sync/protocol/sync_protocol_error.cc
+++ b/sync/protocol/sync_protocol_error.cc
@@ -23,6 +23,7 @@ const char* GetSyncErrorTypeString(SyncProtocolErrorType type) {
ENUM_CASE(MIGRATION_DONE);
ENUM_CASE(INVALID_CREDENTIAL);
ENUM_CASE(DISABLED_BY_ADMIN);
+ ENUM_CASE(USER_ROLLBACK);
ENUM_CASE(UNKNOWN_ERROR);
}
NOTREACHED();
@@ -37,6 +38,7 @@ const char* GetClientActionString(ClientAction action) {
ENUM_CASE(STOP_AND_RESTART_SYNC);
ENUM_CASE(DISABLE_SYNC_ON_CLIENT);
ENUM_CASE(STOP_SYNC_FOR_DISABLED_ACCOUNT);
+ ENUM_CASE(DISABLE_SYNC_AND_ROLLBACK);
ENUM_CASE(UNKNOWN_ACTION);
}
NOTREACHED();
diff --git a/sync/protocol/sync_protocol_error.h b/sync/protocol/sync_protocol_error.h
index be9232d..aef7650 100644
--- a/sync/protocol/sync_protocol_error.h
+++ b/sync/protocol/sync_protocol_error.h
@@ -42,6 +42,9 @@ enum SyncProtocolErrorType {
// An administrator disabled sync for this domain.
DISABLED_BY_ADMIN,
+ // Client told to stop syncing this device and roll back local data.
+ USER_ROLLBACK,
+
// The default value.
UNKNOWN_ERROR
};
@@ -66,6 +69,9 @@ enum ClientAction {
// settings page that account is disabled.
STOP_SYNC_FOR_DISABLED_ACCOUNT,
+ // Disable sync and roll back local model to pre-sync state.
+ DISABLE_SYNC_AND_ROLLBACK,
+
// The default. No action.
UNKNOWN_ACTION
};