diff options
author | albertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-26 16:49:17 +0000 |
---|---|---|
committer | albertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-26 16:49:17 +0000 |
commit | 69c662363089fb85146b570407e859804e8eece7 (patch) | |
tree | b56c70434b6029d7f0e85f7bcce4e5ee23c26609 /sync | |
parent | ba94e11898306d88c5f87c9898707c345c6d3974 (diff) | |
download | chromium_src-69c662363089fb85146b570407e859804e8eece7.zip chromium_src-69c662363089fb85146b570407e859804e8eece7.tar.gz chromium_src-69c662363089fb85146b570407e859804e8eece7.tar.bz2 |
sync: Move the error Action enum to sync_enums.proto so that it can be shared with
the logging proto on the server-side.
R=lipalani
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/9837021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-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 |
6 files changed, 31 insertions, 33 deletions
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. + } } |