diff options
-rw-r--r-- | chrome/browser/sync/test/integration/sync_test.cc | 19 | ||||
-rw-r--r-- | sync/engine/syncer_proto_util.cc | 14 | ||||
-rw-r--r-- | sync/protocol/proto_enum_conversions.cc | 18 | ||||
-rw-r--r-- | sync/protocol/proto_enum_conversions.h | 3 | ||||
-rw-r--r-- | sync/protocol/proto_enum_conversions_unittest.cc | 4 | ||||
-rw-r--r-- | sync/protocol/sync.proto | 13 | ||||
-rw-r--r-- | sync/protocol/sync_enums.proto | 12 |
7 files changed, 40 insertions, 43 deletions
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 57acfb7..c25c438 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -717,25 +717,24 @@ sync_pb::SyncEnums::ErrorType } } -sync_pb::ClientToServerResponse::Error::Action - GetClientToServerResponseAction( - const browser_sync::ClientAction& action) { +sync_pb::SyncEnums::Action GetClientToServerResponseAction( + const browser_sync::ClientAction& action) { switch (action) { case browser_sync::UPGRADE_CLIENT: - return sync_pb::ClientToServerResponse::Error::UPGRADE_CLIENT; + return sync_pb::SyncEnums::UPGRADE_CLIENT; case browser_sync::CLEAR_USER_DATA_AND_RESYNC: - return sync_pb::ClientToServerResponse::Error::CLEAR_USER_DATA_AND_RESYNC; + return sync_pb::SyncEnums::CLEAR_USER_DATA_AND_RESYNC; case browser_sync::ENABLE_SYNC_ON_ACCOUNT: - return sync_pb::ClientToServerResponse::Error::ENABLE_SYNC_ON_ACCOUNT; + return sync_pb::SyncEnums::ENABLE_SYNC_ON_ACCOUNT; case browser_sync::STOP_AND_RESTART_SYNC: - return sync_pb::ClientToServerResponse::Error::STOP_AND_RESTART_SYNC; + return sync_pb::SyncEnums::STOP_AND_RESTART_SYNC; case browser_sync::DISABLE_SYNC_ON_CLIENT: - return sync_pb::ClientToServerResponse::Error::DISABLE_SYNC_ON_CLIENT; + return sync_pb::SyncEnums::DISABLE_SYNC_ON_CLIENT; case browser_sync::UNKNOWN_ACTION: - return sync_pb::ClientToServerResponse::Error::UNKNOWN_ACTION; + return sync_pb::SyncEnums::UNKNOWN_ACTION; default: NOTREACHED(); - return sync_pb::ClientToServerResponse::Error::UNKNOWN_ACTION; + return sync_pb::SyncEnums::UNKNOWN_ACTION; } } diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc index b1ed209..5051b82 100644 --- a/sync/engine/syncer_proto_util.cc +++ b/sync/engine/syncer_proto_util.cc @@ -267,19 +267,19 @@ SyncProtocolErrorType ConvertSyncProtocolErrorTypePBToLocalType( } browser_sync::ClientAction ConvertClientActionPBToLocalClientAction( - const sync_pb::ClientToServerResponse::Error::Action& action) { + const sync_pb::SyncEnums::Action& action) { switch (action) { - case ClientToServerResponse::Error::UPGRADE_CLIENT: + case sync_pb::SyncEnums::UPGRADE_CLIENT: return browser_sync::UPGRADE_CLIENT; - case ClientToServerResponse::Error::CLEAR_USER_DATA_AND_RESYNC: + case sync_pb::SyncEnums::CLEAR_USER_DATA_AND_RESYNC: return browser_sync::CLEAR_USER_DATA_AND_RESYNC; - case ClientToServerResponse::Error::ENABLE_SYNC_ON_ACCOUNT: + case sync_pb::SyncEnums::ENABLE_SYNC_ON_ACCOUNT: return browser_sync::ENABLE_SYNC_ON_ACCOUNT; - case ClientToServerResponse::Error::STOP_AND_RESTART_SYNC: + case sync_pb::SyncEnums::STOP_AND_RESTART_SYNC: return browser_sync::STOP_AND_RESTART_SYNC; - case ClientToServerResponse::Error::DISABLE_SYNC_ON_CLIENT: + case sync_pb::SyncEnums::DISABLE_SYNC_ON_CLIENT: return browser_sync::DISABLE_SYNC_ON_CLIENT; - case ClientToServerResponse::Error::UNKNOWN_ACTION: + case sync_pb::SyncEnums::UNKNOWN_ACTION: return browser_sync::UNKNOWN_ACTION; default: NOTREACHED(); diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc index 04bb9ab..d3a5dec 100644 --- a/sync/protocol/proto_enum_conversions.cc +++ b/sync/protocol/proto_enum_conversions.cc @@ -125,18 +125,16 @@ const char* GetErrorTypeString(sync_pb::SyncEnums::ErrorType error_type) { return ""; } -const char* GetActionString( - sync_pb::ClientToServerResponse::Error::Action action) { - ASSERT_ENUM_BOUNDS(sync_pb::ClientToServerResponse::Error, Action, +const char* GetActionString(sync_pb::SyncEnums::Action action) { + ASSERT_ENUM_BOUNDS(sync_pb::SyncEnums, Action, UPGRADE_CLIENT, UNKNOWN_ACTION); switch (action) { - ENUM_CASE(sync_pb::ClientToServerResponse::Error, UPGRADE_CLIENT); - ENUM_CASE(sync_pb::ClientToServerResponse::Error, - CLEAR_USER_DATA_AND_RESYNC); - ENUM_CASE(sync_pb::ClientToServerResponse::Error, ENABLE_SYNC_ON_ACCOUNT); - ENUM_CASE(sync_pb::ClientToServerResponse::Error, STOP_AND_RESTART_SYNC); - ENUM_CASE(sync_pb::ClientToServerResponse::Error, DISABLE_SYNC_ON_CLIENT); - ENUM_CASE(sync_pb::ClientToServerResponse::Error, UNKNOWN_ACTION); + ENUM_CASE(sync_pb::SyncEnums, UPGRADE_CLIENT); + ENUM_CASE(sync_pb::SyncEnums, CLEAR_USER_DATA_AND_RESYNC); + ENUM_CASE(sync_pb::SyncEnums, ENABLE_SYNC_ON_ACCOUNT); + ENUM_CASE(sync_pb::SyncEnums, STOP_AND_RESTART_SYNC); + ENUM_CASE(sync_pb::SyncEnums, DISABLE_SYNC_ON_CLIENT); + ENUM_CASE(sync_pb::SyncEnums, UNKNOWN_ACTION); } NOTREACHED(); return ""; diff --git a/sync/protocol/proto_enum_conversions.h b/sync/protocol/proto_enum_conversions.h index 9f397a4..450e13f 100644 --- a/sync/protocol/proto_enum_conversions.h +++ b/sync/protocol/proto_enum_conversions.h @@ -37,8 +37,7 @@ const char* GetResponseTypeString( const char* GetErrorTypeString(sync_pb::SyncEnums::ErrorType error_type); -const char* GetActionString( - sync_pb::ClientToServerResponse::Error::Action action); +const char* GetActionString(sync_pb::SyncEnums::Action action); const char* GetDeviceTypeString( sync_pb::SessionHeader::DeviceType device_type); diff --git a/sync/protocol/proto_enum_conversions_unittest.cc b/sync/protocol/proto_enum_conversions_unittest.cc index 91498e7..6cfa26c 100644 --- a/sync/protocol/proto_enum_conversions_unittest.cc +++ b/sync/protocol/proto_enum_conversions_unittest.cc @@ -81,8 +81,8 @@ TEST_F(ProtoEnumConversionsTest, GetErrorTypeString) { TEST_F(ProtoEnumConversionsTest, GetActionString) { TestEnumStringFunction( GetActionString, - sync_pb::ClientToServerResponse::Error::Action_MIN, - sync_pb::ClientToServerResponse::Error::Action_MAX); + sync_pb::SyncEnums::Action_MIN, + sync_pb::SyncEnums::Action_MAX); } } // namespace diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto index dccf99f..e2dde54 100644 --- a/sync/protocol/sync.proto +++ b/sync/protocol/sync.proto @@ -642,18 +642,7 @@ message ClientToServerResponse { optional SyncEnums.ErrorType error_type = 1 [default = UNKNOWN]; optional string error_description = 2; optional string url = 3; - enum Action { - UPGRADE_CLIENT = 0; // Upgrade the client to latest version. - CLEAR_USER_DATA_AND_RESYNC = 1; // Clear user data from dashboard and - // setup sync again. - ENABLE_SYNC_ON_ACCOUNT = 2; // The administrator needs to enable sync - // on the account. - STOP_AND_RESTART_SYNC = 3; // Stop sync and set up sync again. - DISABLE_SYNC_ON_CLIENT = 4; // Wipe the client of all sync data and - // stop syncing. - UNKNOWN_ACTION = 5; // This is the default. - } - optional Action action = 4 [default = UNKNOWN_ACTION]; + optional SyncEnums.Action action = 4 [default = UNKNOWN_ACTION]; // Currently only meaningful if |error_type| is throttled. If this field // is absent then the whole client (all datatypes) is throttled. diff --git a/sync/protocol/sync_enums.proto b/sync/protocol/sync_enums.proto index d28023b..e419183 100644 --- a/sync/protocol/sync_enums.proto +++ b/sync/protocol/sync_enums.proto @@ -61,4 +61,16 @@ message SyncEnums { // out-of-date client parses a value it doesn't // recognize. } + + enum Action { + UPGRADE_CLIENT = 0; // Upgrade the client to latest version. + CLEAR_USER_DATA_AND_RESYNC = 1; // Clear user data from dashboard and + // setup sync again. + ENABLE_SYNC_ON_ACCOUNT = 2; // The administrator needs to enable sync + // on the account. + STOP_AND_RESTART_SYNC = 3; // Stop sync and set up sync again. + DISABLE_SYNC_ON_CLIENT = 4; // Wipe the client of all sync data and + // stop syncing. + UNKNOWN_ACTION = 5; // This is the default. + } } |