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

Side by Side Diff: components/sync/engine_impl/net/loopback_server/permanent_entity.h

Issue 2106743002: WIP: Local sync only... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix after rebase. Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_SYNC_TEST_FAKE_SERVER_PERMANENT_ENTITY_H_ 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_NET_LOOPBACK_SERVER_PERMANENT_ENTITY_H_
6 #define COMPONENTS_SYNC_TEST_FAKE_SERVER_PERMANENT_ENTITY_H_ 6 #define COMPONENTS_SYNC_ENGINE_IMPL_NET_LOOPBACK_SERVER_PERMANENT_ENTITY_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "components/sync/base/model_type.h" 11 #include "components/sync/base/model_type.h"
12 #include "components/sync/engine_impl/net/loopback_server/loopback_server_entity .h"
11 #include "components/sync/protocol/sync.pb.h" 13 #include "components/sync/protocol/sync.pb.h"
12 #include "components/sync/test/fake_server/fake_server_entity.h"
13 14
14 namespace fake_server { 15 namespace syncer {
15 16
16 // A server-created, permanent entity. 17 // A server-created, permanent entity.
17 class PermanentEntity : public FakeServerEntity { 18 class PermanentEntity : public LoopbackServerEntity {
18 public: 19 public:
20 PermanentEntity(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
19 ~PermanentEntity() override; 28 ~PermanentEntity() override;
20 29
21 // Factory function for PermanentEntity. |server_tag| should be a globally 30 // Factory function for PermanentEntity. |server_tag| should be a globally
22 // unique identifier. 31 // unique identifier.
23 static std::unique_ptr<FakeServerEntity> Create( 32 static std::unique_ptr<LoopbackServerEntity> Create(
24 const syncer::ModelType& model_type, 33 const syncer::ModelType& model_type,
25 const std::string& server_tag, 34 const std::string& server_tag,
26 const std::string& name, 35 const std::string& name,
27 const std::string& parent_server_tag); 36 const std::string& parent_server_tag);
28 37
29 // Factory function for a top level PermanentEntity. Top level means that the 38 // Factory function for a top level PermanentEntity. Top level means that the
30 // entity's parent is the root entity (no PermanentEntity exists for root). 39 // entity's parent is the root entity (no PermanentEntity exists for root).
31 static std::unique_ptr<FakeServerEntity> CreateTopLevel( 40 static std::unique_ptr<LoopbackServerEntity> CreateTopLevel(
32 const syncer::ModelType& model_type); 41 const syncer::ModelType& model_type);
33 42
34 // Factory function for creating an updated version of a PermanentEntity. 43 // Factory function for creating an updated version of a PermanentEntity.
35 // This function should only be called for the Nigori entity. 44 // This function should only be called for the Nigori entity.
36 static std::unique_ptr<FakeServerEntity> CreateUpdatedNigoriEntity( 45 static std::unique_ptr<LoopbackServerEntity> CreateUpdatedNigoriEntity(
37 const sync_pb::SyncEntity& client_entity, 46 const sync_pb::SyncEntity& client_entity,
38 const FakeServerEntity& current_server_entity); 47 const LoopbackServerEntity& current_server_entity);
39 48
40 // FakeServerEntity implementation. 49 // LoopbackServerEntity implementation.
41 bool RequiresParentId() const override; 50 bool RequiresParentId() const override;
42 std::string GetParentId() const override; 51 std::string GetParentId() const override;
43 void SerializeAsProto(sync_pb::SyncEntity* proto) const override; 52 void SerializeAsProto(sync_pb::SyncEntity* proto) const override;
44 bool IsFolder() const override; 53 bool IsFolder() const override;
45 bool IsPermanent() const override; 54 bool IsPermanent() const override;
46 55
47 private: 56 private:
48 PermanentEntity(const std::string& id,
49 const syncer::ModelType& model_type,
50 const std::string& name,
51 const std::string& parent_id,
52 const std::string& server_defined_unique_tag,
53 const sync_pb::EntitySpecifics& entity_specifics);
54
55 // All member values have equivalent fields in SyncEntity. 57 // All member values have equivalent fields in SyncEntity.
56 std::string server_defined_unique_tag_; 58 std::string server_defined_unique_tag_;
57 std::string parent_id_; 59 std::string parent_id_;
58 }; 60 };
59 61
60 } // namespace fake_server 62 } // namespace syncer
61 63
62 #endif // COMPONENTS_SYNC_TEST_FAKE_SERVER_PERMANENT_ENTITY_H_ 64 #endif // COMPONENTS_SYNC_ENGINE_IMPL_NET_LOOPBACK_SERVER_PERMANENT_ENTITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698