Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: components/sync/engine_impl/loopback_server/persistent_unique_client_entity.cc

Issue 2887343002: wip 3 (Closed)
Patch Set: cleanup Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..1f731e15ba3f9b7f5f847d71dae4ddd5d64d0cb0 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"
@@ -45,6 +46,20 @@ std::unique_ptr<LoopbackServerEntity> PersistentUniqueClientEntity::Create(
}
// static
+std::unique_ptr<LoopbackServerEntity>
+PersistentUniqueClientEntity::CreateForInjection(
+ 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(

Powered by Google App Engine
This is Rietveld 408576698