#include "components/sync/engine/syncer_proto_util.h"
#include <map>
#include <optional>
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/features.h"
#include "components/sync/base/time.h"
#include "components/sync/engine/cycle/sync_cycle_context.h"
#include "components/sync/engine/net/server_connection_manager.h"
#include "components/sync/engine/sync_protocol_error.h"
#include "components/sync/engine/syncer.h"
#include "components/sync/engine/traffic_logger.h"
#include "components/sync/protocol/data_type_progress_marker.pb.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "google_apis/google_api_keys.h"
#include "net/http/http_status_code.h"
string;
stringstream;
ClientToServerMessage;
ClientToServerResponse;
namespace syncer {
namespace {
constexpr base::TimeDelta kSyncDelayAfterThrottled = …;
SyncerError ServerConnectionErrorAsSyncerError(
const HttpResponse::ServerConnectionCode server_status,
int net_error_code,
int http_status_code) { … }
SyncProtocolErrorType PBErrorTypeToSyncProtocolErrorType(
const sync_pb::SyncEnums::ErrorType& error_type) { … }
ClientAction PBActionToClientAction(const sync_pb::SyncEnums::Action& action) { … }
bool IsVeryFirstGetUpdates(const ClientToServerMessage& message) { … }
bool IsBirthdayRequired(const ClientToServerMessage& message) { … }
SyncProtocolError ErrorCodeToSyncProtocolError(
const sync_pb::SyncEnums::ErrorType& error_type) { … }
bool ProcessResponseBirthday(const ClientToServerResponse& response,
SyncCycleContext* context) { … }
void SaveBagOfChipsFromResponse(const sync_pb::ClientToServerResponse& response,
SyncCycleContext* context) { … }
void ProcessClientCommand(const sync_pb::ClientCommand& command,
SyncCycle* cycle) { … }
}
DataTypeSet GetTypesToMigrate(const ClientToServerResponse& response) { … }
SyncProtocolError ConvertErrorPBToSyncProtocolError(
const sync_pb::ClientToServerResponse_Error& error) { … }
SyncerError SyncerProtoUtil::HandleClientToServerMessageResponse(
const sync_pb::ClientToServerResponse& response,
SyncCycle* cycle,
DataTypeSet* partial_failure_data_types) { … }
bool SyncerProtoUtil::IsSyncDisabledByAdmin(
const sync_pb::ClientToServerResponse& response) { … }
SyncProtocolError SyncerProtoUtil::GetProtocolErrorFromResponse(
const sync_pb::ClientToServerResponse& response,
SyncCycleContext* context) { … }
void SyncerProtoUtil::SetProtocolVersion(ClientToServerMessage* msg) { … }
bool SyncerProtoUtil::PostAndProcessHeaders(ServerConnectionManager* scm,
const ClientToServerMessage& msg,
ClientToServerResponse* response) { … }
base::TimeDelta SyncerProtoUtil::GetThrottleDelay(
const ClientToServerResponse& response) { … }
void SyncerProtoUtil::AddRequiredFieldsToClientToServerMessage(
const SyncCycle* cycle,
sync_pb::ClientToServerMessage* msg) { … }
SyncerError SyncerProtoUtil::PostClientToServerMessage(
const ClientToServerMessage& msg,
ClientToServerResponse* response,
SyncCycle* cycle,
DataTypeSet* partial_failure_data_types) { … }
bool SyncerProtoUtil::ShouldMaintainPosition(
const sync_pb::SyncEntity& sync_entity) { … }
bool SyncerProtoUtil::ShouldMaintainHierarchy(
const sync_pb::SyncEntity& sync_entity) { … }
std::string SyncerProtoUtil::SyncEntityDebugString(
const sync_pb::SyncEntity& entry) { … }
namespace {
std::string GetUpdatesResponseString(
const sync_pb::GetUpdatesResponse& response) { … }
}
std::string SyncerProtoUtil::ClientToServerResponseDebugString(
const ClientToServerResponse& response) { … }
}