| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_PERSISTENT_UNIQUE_CLIENT_ENT
ITY_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_PERSISTENT_UNIQUE_CLIENT_ENT
ITY_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <memory> |
| 11 #include <string> |
| 12 |
| 13 #include "components/sync/base/model_type.h" |
| 14 #include "components/sync/engine_impl/loopback_server/loopback_server_entity.h" |
| 15 |
| 16 namespace sync_pb { |
| 17 class EntitySpecifics; |
| 18 class SyncEntity; |
| 19 } // namespace sync_pb |
| 20 |
| 21 namespace syncer { |
| 22 |
| 23 // An entity that is unique per client account. |
| 24 // |
| 25 // TODO(pvalenzuela): Reconsider the naming of this class. In some cases, this |
| 26 // type is used to represent entities where the unique client tag is irrelevant |
| 27 // (e.g., Autofill Wallet). |
| 28 class PersistentUniqueClientEntity : public LoopbackServerEntity { |
| 29 public: |
| 30 PersistentUniqueClientEntity(const std::string& id, |
| 31 syncer::ModelType model_type, |
| 32 int64_t version, |
| 33 const std::string& name, |
| 34 const std::string& client_defined_unique_tag, |
| 35 const sync_pb::EntitySpecifics& specifics, |
| 36 int64_t creation_time, |
| 37 int64_t last_modified_time); |
| 38 |
| 39 ~PersistentUniqueClientEntity() override; |
| 40 |
| 41 // Factory function for creating a PersistentUniqueClientEntity. |
| 42 static std::unique_ptr<LoopbackServerEntity> Create( |
| 43 const sync_pb::SyncEntity& client_entity); |
| 44 |
| 45 // Derives an ID from a unique client tagged entity. |
| 46 static std::string EffectiveIdForClientTaggedEntity( |
| 47 const sync_pb::SyncEntity& entity); |
| 48 |
| 49 // LoopbackServerEntity implementation. |
| 50 bool RequiresParentId() const override; |
| 51 std::string GetParentId() const override; |
| 52 void SerializeAsProto(sync_pb::SyncEntity* proto) const override; |
| 53 sync_pb::LoopbackServerEntity_Type GetLoopbackServerEntityType() |
| 54 const override; |
| 55 |
| 56 private: |
| 57 // These member values have equivalent fields in SyncEntity. |
| 58 std::string client_defined_unique_tag_; |
| 59 int64_t creation_time_; |
| 60 int64_t last_modified_time_; |
| 61 }; |
| 62 |
| 63 } // namespace syncer |
| 64 |
| 65 #endif // COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_PERSISTENT_UNIQUE_CLIENT_
ENTITY_H_ |
| OLD | NEW |