| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/sync/test/fake_server/tombstone_entity.h" | 5 #include "components/sync/test/fake_server/tombstone_entity.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "components/sync/base/model_type.h" | 9 #include "components/sync/base/model_type.h" |
| 10 #include "components/sync/protocol/sync.pb.h" | 10 #include "components/sync/protocol/sync.pb.h" |
| 11 #include "components/sync/test/fake_server/fake_server_entity.h" | 11 #include "components/sync/test/fake_server/fake_server_entity.h" |
| 12 | 12 |
| 13 using std::string; | 13 using std::string; |
| 14 | 14 |
| 15 using syncer::ModelType; | 15 using syncer::ModelType; |
| 16 | 16 |
| 17 namespace fake_server { | 17 namespace fake_server { |
| 18 | 18 |
| 19 TombstoneEntity::~TombstoneEntity() {} | 19 TombstoneEntity::~TombstoneEntity() {} |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 std::unique_ptr<FakeServerEntity> TombstoneEntity::Create(const string& id) { | 22 std::unique_ptr<FakeServerEntity> TombstoneEntity::Create( |
| 23 const string& id, |
| 24 const string& client_defined_unique_tag) { |
| 23 const ModelType model_type = GetModelTypeFromId(id); | 25 const ModelType model_type = GetModelTypeFromId(id); |
| 24 CHECK_NE(model_type, syncer::UNSPECIFIED) << "Invalid ID was given: " << id; | 26 CHECK_NE(model_type, syncer::UNSPECIFIED) << "Invalid ID was given: " << id; |
| 25 return std::unique_ptr<FakeServerEntity>(new TombstoneEntity(id, model_type)); | 27 return std::unique_ptr<FakeServerEntity>( |
| 28 new TombstoneEntity(id, client_defined_unique_tag, model_type)); |
| 26 } | 29 } |
| 27 | 30 |
| 28 TombstoneEntity::TombstoneEntity(const string& id, const ModelType& model_type) | 31 TombstoneEntity::TombstoneEntity(const string& id, |
| 29 : FakeServerEntity(id, model_type, 0, string()) { | 32 const string& client_defined_unique_tag, |
| 33 const ModelType& model_type) |
| 34 : FakeServerEntity(id, client_defined_unique_tag, model_type, 0, string()) { |
| 30 sync_pb::EntitySpecifics specifics; | 35 sync_pb::EntitySpecifics specifics; |
| 31 AddDefaultFieldValue(model_type, &specifics); | 36 AddDefaultFieldValue(model_type, &specifics); |
| 32 SetSpecifics(specifics); | 37 SetSpecifics(specifics); |
| 33 } | 38 } |
| 34 | 39 |
| 35 bool TombstoneEntity::RequiresParentId() const { | 40 bool TombstoneEntity::RequiresParentId() const { |
| 36 return false; | 41 return false; |
| 37 } | 42 } |
| 38 | 43 |
| 39 string TombstoneEntity::GetParentId() const { | 44 string TombstoneEntity::GetParentId() const { |
| 40 return string(); | 45 return string(); |
| 41 } | 46 } |
| 42 | 47 |
| 43 void TombstoneEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const { | 48 void TombstoneEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const { |
| 44 FakeServerEntity::SerializeBaseProtoFields(proto); | 49 FakeServerEntity::SerializeBaseProtoFields(proto); |
| 45 } | 50 } |
| 46 | 51 |
| 47 bool TombstoneEntity::IsDeleted() const { | 52 bool TombstoneEntity::IsDeleted() const { |
| 48 return true; | 53 return true; |
| 49 } | 54 } |
| 50 | 55 |
| 51 } // namespace fake_server | 56 } // namespace fake_server |
| OLD | NEW |