| Index: components/sync/engine_impl/loopback_server/persistent_unique_client_entity.cc
|
| diff --git a/components/sync/engine_impl/loopback_server/persistent_unique_client_entity.cc b/components/sync/engine_impl/loopback_server/persistent_unique_client_entity.cc
|
| index 9a2b8725b17d1d4c877cc6e15c0a33f6ad4df74e..2554ab6a39b7b448c9b51e793274bd0b9e7e21ae 100644
|
| --- a/components/sync/engine_impl/loopback_server/persistent_unique_client_entity.cc
|
| +++ b/components/sync/engine_impl/loopback_server/persistent_unique_client_entity.cc
|
| @@ -5,6 +5,7 @@
|
| #include "components/sync/engine_impl/loopback_server/persistent_unique_client_entity.h"
|
|
|
| #include "base/guid.h"
|
| +#include "components/sync/base/hash_util.h"
|
| #include "components/sync/engine_impl/loopback_server/persistent_permanent_entity.h"
|
| #include "components/sync/protocol/sync.pb.h"
|
|
|
| @@ -31,7 +32,8 @@ PersistentUniqueClientEntity::PersistentUniqueClientEntity(
|
| PersistentUniqueClientEntity::~PersistentUniqueClientEntity() {}
|
|
|
| // static
|
| -std::unique_ptr<LoopbackServerEntity> PersistentUniqueClientEntity::Create(
|
| +std::unique_ptr<LoopbackServerEntity>
|
| +PersistentUniqueClientEntity::CreateFromEntity(
|
| const sync_pb::SyncEntity& client_entity) {
|
| CHECK(client_entity.has_client_defined_unique_tag())
|
| << "A PersistentUniqueClientEntity must have a client-defined unique "
|
| @@ -45,6 +47,20 @@ std::unique_ptr<LoopbackServerEntity> PersistentUniqueClientEntity::Create(
|
| }
|
|
|
| // static
|
| +std::unique_ptr<LoopbackServerEntity>
|
| +PersistentUniqueClientEntity::CreateFromEntitySpecifics(
|
| + const string& name,
|
| + const sync_pb::EntitySpecifics& entity_specifics) {
|
| + ModelType model_type = GetModelTypeFromSpecifics(entity_specifics);
|
| + string client_defined_unique_tag = GenerateSyncableHash(model_type, name);
|
| + string id =
|
| + LoopbackServerEntity::CreateId(model_type, client_defined_unique_tag);
|
| + return std::unique_ptr<LoopbackServerEntity>(new PersistentUniqueClientEntity(
|
| + id, model_type, 0, name, client_defined_unique_tag, entity_specifics,
|
| + 1337, 1337));
|
| +}
|
| +
|
| +// static
|
| std::string PersistentUniqueClientEntity::EffectiveIdForClientTaggedEntity(
|
| const sync_pb::SyncEntity& entity) {
|
| return LoopbackServerEntity::CreateId(
|
|
|