| 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/engine_impl/loopback_server/persistent_unique_client_e
ntity.h" | 5 #include "components/sync/engine_impl/loopback_server/persistent_unique_client_e
ntity.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 creation_time_(creation_time), | 33 creation_time_(creation_time), |
| 34 last_modified_time_(last_modified_time) { | 34 last_modified_time_(last_modified_time) { |
| 35 SetSpecifics(specifics); | 35 SetSpecifics(specifics); |
| 36 } | 36 } |
| 37 | 37 |
| 38 PersistentUniqueClientEntity::~PersistentUniqueClientEntity() {} | 38 PersistentUniqueClientEntity::~PersistentUniqueClientEntity() {} |
| 39 | 39 |
| 40 // static | 40 // static |
| 41 std::unique_ptr<LoopbackServerEntity> PersistentUniqueClientEntity::Create( | 41 std::unique_ptr<LoopbackServerEntity> PersistentUniqueClientEntity::Create( |
| 42 const sync_pb::SyncEntity& client_entity) { | 42 const sync_pb::SyncEntity& client_entity) { |
| 43 CHECK(client_entity.has_client_defined_unique_tag()) | 43 // A PersistentUniqueClientEntity must have a client-defined unique tag. |
| 44 << "A PersistentUniqueClientEntity must have a client-defined unique " | 44 CHECK(client_entity.has_client_defined_unique_tag()); |
| 45 "tag."; | |
| 46 ModelType model_type = GetModelTypeFromSpecifics(client_entity.specifics()); | 45 ModelType model_type = GetModelTypeFromSpecifics(client_entity.specifics()); |
| 47 string id = EffectiveIdForClientTaggedEntity(client_entity); | 46 string id = EffectiveIdForClientTaggedEntity(client_entity); |
| 48 return std::unique_ptr<LoopbackServerEntity>(new PersistentUniqueClientEntity( | 47 return std::unique_ptr<LoopbackServerEntity>(new PersistentUniqueClientEntity( |
| 49 id, model_type, client_entity.version(), client_entity.name(), | 48 id, model_type, client_entity.version(), client_entity.name(), |
| 50 client_entity.client_defined_unique_tag(), client_entity.specifics(), | 49 client_entity.client_defined_unique_tag(), client_entity.specifics(), |
| 51 client_entity.ctime(), client_entity.mtime())); | 50 client_entity.ctime(), client_entity.mtime())); |
| 52 } | 51 } |
| 53 | 52 |
| 54 // static | 53 // static |
| 55 std::string PersistentUniqueClientEntity::EffectiveIdForClientTaggedEntity( | 54 std::string PersistentUniqueClientEntity::EffectiveIdForClientTaggedEntity( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 77 void PersistentUniqueClientEntity::SerializeAsProto( | 76 void PersistentUniqueClientEntity::SerializeAsProto( |
| 78 sync_pb::SyncEntity* proto) const { | 77 sync_pb::SyncEntity* proto) const { |
| 79 LoopbackServerEntity::SerializeBaseProtoFields(proto); | 78 LoopbackServerEntity::SerializeBaseProtoFields(proto); |
| 80 | 79 |
| 81 proto->set_client_defined_unique_tag(client_defined_unique_tag_); | 80 proto->set_client_defined_unique_tag(client_defined_unique_tag_); |
| 82 proto->set_ctime(creation_time_); | 81 proto->set_ctime(creation_time_); |
| 83 proto->set_mtime(last_modified_time_); | 82 proto->set_mtime(last_modified_time_); |
| 84 } | 83 } |
| 85 | 84 |
| 86 } // namespace syncer | 85 } // namespace syncer |
| OLD | NEW |