diff options
Diffstat (limited to 'sync/engine/syncer_proto_util.cc')
-rw-r--r-- | sync/engine/syncer_proto_util.cc | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc index 8be6888..e88bc06 100644 --- a/sync/engine/syncer_proto_util.cc +++ b/sync/engine/syncer_proto_util.cc @@ -21,7 +21,7 @@ #include "sync/syncable/syncable-inl.h" #include "sync/util/time.h" -using csync::SyncProtocolErrorType; +using syncer::SyncProtocolErrorType; using std::string; using std::stringstream; using syncable::BASE_VERSION; @@ -33,7 +33,7 @@ using syncable::IS_UNSYNCED; using syncable::MTIME; using syncable::PARENT_ID; -namespace csync { +namespace syncer { using sessions::SyncSession; namespace { @@ -217,7 +217,7 @@ void SyncerProtoUtil::HandleThrottleError( const base::TimeTicks& throttled_until, ThrottledDataTypeTracker* tracker, sessions::SyncSession::Delegate* delegate) { - DCHECK_EQ(error.error_type, csync::THROTTLED); + DCHECK_EQ(error.error_type, syncer::THROTTLED); if (error.error_data_types.Empty()) { // No datatypes indicates the client should be completely throttled. delegate->OnSilencedUntil(throttled_until); @@ -244,53 +244,53 @@ SyncProtocolErrorType ConvertSyncProtocolErrorTypePBToLocalType( const sync_pb::SyncEnums::ErrorType& error_type) { switch (error_type) { case sync_pb::SyncEnums::SUCCESS: - return csync::SYNC_SUCCESS; + return syncer::SYNC_SUCCESS; case sync_pb::SyncEnums::NOT_MY_BIRTHDAY: - return csync::NOT_MY_BIRTHDAY; + return syncer::NOT_MY_BIRTHDAY; case sync_pb::SyncEnums::THROTTLED: - return csync::THROTTLED; + return syncer::THROTTLED; case sync_pb::SyncEnums::CLEAR_PENDING: - return csync::CLEAR_PENDING; + return syncer::CLEAR_PENDING; case sync_pb::SyncEnums::TRANSIENT_ERROR: - return csync::TRANSIENT_ERROR; + return syncer::TRANSIENT_ERROR; case sync_pb::SyncEnums::MIGRATION_DONE: - return csync::MIGRATION_DONE; + return syncer::MIGRATION_DONE; case sync_pb::SyncEnums::UNKNOWN: - return csync::UNKNOWN_ERROR; + return syncer::UNKNOWN_ERROR; case sync_pb::SyncEnums::USER_NOT_ACTIVATED: case sync_pb::SyncEnums::AUTH_INVALID: case sync_pb::SyncEnums::ACCESS_DENIED: - return csync::INVALID_CREDENTIAL; + return syncer::INVALID_CREDENTIAL; default: NOTREACHED(); - return csync::UNKNOWN_ERROR; + return syncer::UNKNOWN_ERROR; } } -csync::ClientAction ConvertClientActionPBToLocalClientAction( +syncer::ClientAction ConvertClientActionPBToLocalClientAction( const sync_pb::SyncEnums::Action& action) { switch (action) { case sync_pb::SyncEnums::UPGRADE_CLIENT: - return csync::UPGRADE_CLIENT; + return syncer::UPGRADE_CLIENT; case sync_pb::SyncEnums::CLEAR_USER_DATA_AND_RESYNC: - return csync::CLEAR_USER_DATA_AND_RESYNC; + return syncer::CLEAR_USER_DATA_AND_RESYNC; case sync_pb::SyncEnums::ENABLE_SYNC_ON_ACCOUNT: - return csync::ENABLE_SYNC_ON_ACCOUNT; + return syncer::ENABLE_SYNC_ON_ACCOUNT; case sync_pb::SyncEnums::STOP_AND_RESTART_SYNC: - return csync::STOP_AND_RESTART_SYNC; + return syncer::STOP_AND_RESTART_SYNC; case sync_pb::SyncEnums::DISABLE_SYNC_ON_CLIENT: - return csync::DISABLE_SYNC_ON_CLIENT; + return syncer::DISABLE_SYNC_ON_CLIENT; case sync_pb::SyncEnums::UNKNOWN_ACTION: - return csync::UNKNOWN_ACTION; + return syncer::UNKNOWN_ACTION; default: NOTREACHED(); - return csync::UNKNOWN_ACTION; + return syncer::UNKNOWN_ACTION; } } -csync::SyncProtocolError ConvertErrorPBToLocalType( +syncer::SyncProtocolError ConvertErrorPBToLocalType( const sync_pb::ClientToServerResponse::Error& error) { - csync::SyncProtocolError sync_protocol_error; + syncer::SyncProtocolError sync_protocol_error; sync_protocol_error.error_type = ConvertSyncProtocolErrorTypePBToLocalType( error.error_type()); sync_protocol_error.error_description = error.error_description(); @@ -312,13 +312,13 @@ csync::SyncProtocolError ConvertErrorPBToLocalType( } // TODO(lipalani) : Rename these function names as per the CR for issue 7740067. -csync::SyncProtocolError ConvertLegacyErrorCodeToNewError( +syncer::SyncProtocolError ConvertLegacyErrorCodeToNewError( const sync_pb::SyncEnums::ErrorType& error_type) { - csync::SyncProtocolError error; + syncer::SyncProtocolError error; error.error_type = ConvertSyncProtocolErrorTypePBToLocalType(error_type); if (error_type == sync_pb::SyncEnums::CLEAR_PENDING || error_type == sync_pb::SyncEnums::NOT_MY_BIRTHDAY) { - error.action = csync::DISABLE_SYNC_ON_CLIENT; + error.action = syncer::DISABLE_SYNC_ON_CLIENT; } // There is no other action we can compute for legacy server. return error; } @@ -345,11 +345,11 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage( msg, response)) { // There was an error establishing communication with the server. // We can not proceed beyond this point. - const csync::HttpResponse::ServerConnectionCode server_status = + const syncer::HttpResponse::ServerConnectionCode server_status = session->context()->connection_manager()->server_status(); - DCHECK_NE(server_status, csync::HttpResponse::NONE); - DCHECK_NE(server_status, csync::HttpResponse::SERVER_CONNECTION_OK); + DCHECK_NE(server_status, syncer::HttpResponse::NONE); + DCHECK_NE(server_status, syncer::HttpResponse::SERVER_CONNECTION_OK); return ServerConnectionErrorAsSyncerError(server_status); } @@ -358,13 +358,13 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage( session->context()->traffic_recorder()->RecordClientToServerResponse( *response); - csync::SyncProtocolError sync_protocol_error; + syncer::SyncProtocolError sync_protocol_error; // Birthday mismatch overrides any error that is sent by the server. if (!VerifyResponseBirthday(dir, response)) { - sync_protocol_error.error_type = csync::NOT_MY_BIRTHDAY; + sync_protocol_error.error_type = syncer::NOT_MY_BIRTHDAY; sync_protocol_error.action = - csync::DISABLE_SYNC_ON_CLIENT; + syncer::DISABLE_SYNC_ON_CLIENT; } else if (response->has_error()) { // This is a new server. Just get the error from the protocol. sync_protocol_error = ConvertErrorPBToLocalType(response->error()); @@ -384,28 +384,28 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage( // Now do any special handling for the error type and decide on the return // value. switch (sync_protocol_error.error_type) { - case csync::UNKNOWN_ERROR: + case syncer::UNKNOWN_ERROR: LOG(WARNING) << "Sync protocol out-of-date. The server is using a more " << "recent version."; return SERVER_RETURN_UNKNOWN_ERROR; - case csync::SYNC_SUCCESS: + case syncer::SYNC_SUCCESS: LogResponseProfilingData(*response); return SYNCER_OK; - case csync::THROTTLED: + case syncer::THROTTLED: LOG(WARNING) << "Client silenced by server."; HandleThrottleError(sync_protocol_error, base::TimeTicks::Now() + GetThrottleDelay(*response), session->context()->throttled_data_type_tracker(), session->delegate()); return SERVER_RETURN_THROTTLED; - case csync::TRANSIENT_ERROR: + case syncer::TRANSIENT_ERROR: return SERVER_RETURN_TRANSIENT_ERROR; - case csync::MIGRATION_DONE: + case syncer::MIGRATION_DONE: HandleMigrationDoneResponse(response, session); return SERVER_RETURN_MIGRATION_DONE; - case csync::CLEAR_PENDING: + case syncer::CLEAR_PENDING: return SERVER_RETURN_CLEAR_PENDING; - case csync::NOT_MY_BIRTHDAY: + case syncer::NOT_MY_BIRTHDAY: return SERVER_RETURN_NOT_MY_BIRTHDAY; default: NOTREACHED(); @@ -542,4 +542,4 @@ std::string SyncerProtoUtil::ClientToServerResponseDebugString( return output; } -} // namespace csync +} // namespace syncer |