Chromium Code Reviews| 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_PERMANENT_ENTITY_ H_ | |
| 6 #define COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_PERSISTENT_PERMANENT_ENTITY_ H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "components/sync/base/model_type.h" | |
| 12 #include "components/sync/engine_impl/loopback_server/loopback_server_entity.h" | |
| 13 #include "components/sync/protocol/sync.pb.h" | |
| 14 | |
| 15 namespace syncer { | |
| 16 | |
| 17 // A server-created, permanent entity. | |
| 18 class PersistentPermanentEntity : public LoopbackServerEntity { | |
| 19 public: | |
| 20 PersistentPermanentEntity(const std::string& id, | |
| 21 int64_t version, | |
| 22 const syncer::ModelType& model_type, | |
| 23 const std::string& name, | |
| 24 const std::string& parent_id, | |
| 25 const std::string& server_defined_unique_tag, | |
| 26 const sync_pb::EntitySpecifics& entity_specifics); | |
| 27 | |
| 28 ~PersistentPermanentEntity() override; | |
| 29 | |
| 30 // Factory function for PersistentPermanentEntity. |server_tag| should be a | |
| 31 // globally | |
|
pavely
2016/10/06 23:48:46
Could you reformat line wraps in comments.
pastarmovj
2016/10/13 14:13:40
Done.
| |
| 32 // unique identifier. | |
| 33 static std::unique_ptr<LoopbackServerEntity> Create( | |
| 34 const syncer::ModelType& model_type, | |
| 35 const std::string& server_tag, | |
| 36 const std::string& name, | |
| 37 const std::string& parent_server_tag); | |
| 38 | |
| 39 // Factory function for a top level PersistentPermanentEntity. Top level means | |
| 40 // that the | |
| 41 // entity's parent is the root entity (no PersistentPermanentEntity exists for | |
| 42 // root). | |
| 43 static std::unique_ptr<LoopbackServerEntity> CreateTopLevel( | |
| 44 const syncer::ModelType& model_type); | |
| 45 | |
| 46 // Factory function for creating an updated version of a | |
| 47 // PersistentPermanentEntity. | |
| 48 // This function should only be called for the Nigori entity. | |
| 49 static std::unique_ptr<LoopbackServerEntity> CreateUpdatedNigoriEntity( | |
| 50 const sync_pb::SyncEntity& client_entity, | |
| 51 const LoopbackServerEntity& current_server_entity); | |
| 52 | |
| 53 // LoopbackServerEntity implementation. | |
| 54 bool RequiresParentId() const override; | |
| 55 std::string GetParentId() const override; | |
| 56 void SerializeAsProto(sync_pb::SyncEntity* proto) const override; | |
| 57 bool IsFolder() const override; | |
| 58 bool IsPermanent() const override; | |
| 59 | |
| 60 private: | |
| 61 // All member values have equivalent fields in SyncEntity. | |
| 62 std::string server_defined_unique_tag_; | |
| 63 std::string parent_id_; | |
| 64 }; | |
| 65 | |
| 66 } // namespace syncer | |
| 67 | |
| 68 #endif // COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_PERSISTENT_PERMANENT_ENTI TY_H_ | |
| OLD | NEW |