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

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

Powered by Google App Engine
This is Rietveld 408576698