| Index: components/sync/engine_impl/loopback_server/persistent_tombstone_entity.cc
|
| diff --git a/components/sync/engine_impl/loopback_server/persistent_tombstone_entity.cc b/components/sync/engine_impl/loopback_server/persistent_tombstone_entity.cc
|
| index a32b134c0720f4287ffc6e5407eea9c69851b6b6..f1e3c5aff66da6c03ba28e6601202eba188f0049 100644
|
| --- a/components/sync/engine_impl/loopback_server/persistent_tombstone_entity.cc
|
| +++ b/components/sync/engine_impl/loopback_server/persistent_tombstone_entity.cc
|
| @@ -13,20 +13,33 @@ namespace syncer {
|
| PersistentTombstoneEntity::~PersistentTombstoneEntity() {}
|
|
|
| // static
|
| -std::unique_ptr<LoopbackServerEntity> PersistentTombstoneEntity::Create(
|
| - const sync_pb::SyncEntity& entity) {
|
| +std::unique_ptr<LoopbackServerEntity>
|
| +PersistentTombstoneEntity::CreateFromEntity(const sync_pb::SyncEntity& entity) {
|
| const ModelType model_type = GetModelTypeFromId(entity.id_string());
|
| CHECK_NE(model_type, syncer::UNSPECIFIED) << "Invalid ID was given: "
|
| << entity.id_string();
|
| return std::unique_ptr<LoopbackServerEntity>(new PersistentTombstoneEntity(
|
| - entity.id_string(), entity.version(), model_type));
|
| + entity.id_string(), entity.version(), model_type,
|
| + entity.client_defined_unique_tag()));
|
| +}
|
| +
|
| +// static
|
| +std::unique_ptr<LoopbackServerEntity> PersistentTombstoneEntity::CreateNew(
|
| + const std::string& id,
|
| + const std::string& client_defined_unique_tag) {
|
| + const ModelType model_type = GetModelTypeFromId(id);
|
| + CHECK_NE(model_type, syncer::UNSPECIFIED) << "Invalid ID was given: " << id;
|
| + return std::unique_ptr<LoopbackServerEntity>(new PersistentTombstoneEntity(
|
| + id, 0, model_type, client_defined_unique_tag));
|
| }
|
|
|
| PersistentTombstoneEntity::PersistentTombstoneEntity(
|
| const string& id,
|
| int64_t version,
|
| - const ModelType& model_type)
|
| - : LoopbackServerEntity(id, model_type, version, string()) {
|
| + const ModelType& model_type,
|
| + const std::string& client_defined_unique_tag)
|
| + : LoopbackServerEntity(id, model_type, version, string()),
|
| + client_defined_unique_tag_(client_defined_unique_tag) {
|
| sync_pb::EntitySpecifics specifics;
|
| AddDefaultFieldValue(model_type, &specifics);
|
| SetSpecifics(specifics);
|
| @@ -43,6 +56,8 @@ string PersistentTombstoneEntity::GetParentId() const {
|
| void PersistentTombstoneEntity::SerializeAsProto(
|
| sync_pb::SyncEntity* proto) const {
|
| LoopbackServerEntity::SerializeBaseProtoFields(proto);
|
| + if (!client_defined_unique_tag_.empty())
|
| + proto->set_client_defined_unique_tag(client_defined_unique_tag_);
|
| }
|
|
|
| bool PersistentTombstoneEntity::IsDeleted() const {
|
|
|