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

Side by Side Diff: components/sync/engine_impl/loopback_server/persistent_bookmark_entity.h

Issue 2360703002: [Sync] Implements the loopback sync server. (Closed)
Patch Set: Shuffle and rename stuff around. Created 4 years, 2 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
(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_BOOKMARK_ENTITY_H _
6 #define COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_PERSISTENT_BOOKMARK_ENTITY_H _
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <memory>
12 #include <string>
13
14 #include "components/sync/base/model_type.h"
15 #include "components/sync/engine_impl/loopback_server/loopback_server_entity.h"
16 #include "components/sync/protocol/sync.pb.h"
17
18 namespace syncer {
19
20 // A bookmark version of LoopbackServerEntity. This type represents entities
21 // that are non-deleted, client-created, and not unique per client account.
22 class PersistentBookmarkEntity : public LoopbackServerEntity {
23 public:
24 ~PersistentBookmarkEntity() override;
25
26 // Factory function for PersistentBookmarkEntity. This factory should be used
27 // only for
pavely 2016/10/06 23:48:46 Could you join this line with the next one. The sa
pastarmovj 2016/10/13 14:13:40 Done.
28 // the first time that a specific bookmark is seen by the server.
29 static std::unique_ptr<LoopbackServerEntity> CreateNew(
30 const sync_pb::SyncEntity& client_entity,
31 const std::string& parent_id,
32 const std::string& client_guid);
33
34 // Factory function for PersistentBookmarkEntity. The server's current entity
35 // for this
36 // ID, |current_server_entity|, is passed here because the client does not
37 // always send the complete entity over the wire. This requires copying of
38 // some of the existing entity when creating a new entity.
39 static std::unique_ptr<LoopbackServerEntity> CreateUpdatedVersion(
40 const sync_pb::SyncEntity& client_entity,
41 const LoopbackServerEntity& current_server_entity,
42 const std::string& parent_id);
43
44 static std::unique_ptr<LoopbackServerEntity> CreateFromEntity(
pavely 2016/10/06 23:48:45 Could you add comment in which scenario this facto
pastarmovj 2016/10/13 14:13:40 Done.
45 const sync_pb::SyncEntity& client_entity);
46
47 PersistentBookmarkEntity(const std::string& id,
48 int64_t version,
49 const std::string& name,
50 const std::string& originator_cache_guid,
51 const std::string& originator_client_item_id,
52 const sync_pb::UniquePosition& unique_position,
53 const sync_pb::EntitySpecifics& specifics,
54 bool is_folder,
55 const std::string& parent_id,
56 int64_t creation_time,
57 int64_t last_modified_time);
58
59 void SetParentId(const std::string& parent_id);
60
61 // LoopbackServerEntity implementation.
62 bool RequiresParentId() const override;
63 std::string GetParentId() const override;
64 void SerializeAsProto(sync_pb::SyncEntity* proto) const override;
65 bool IsFolder() const override;
66
67 private:
68 // All member values have equivalent fields in SyncEntity.
69 std::string originator_cache_guid_;
70 std::string originator_client_item_id_;
71 sync_pb::UniquePosition unique_position_;
72 bool is_folder_;
73 std::string parent_id_;
74 int64_t creation_time_;
75 int64_t last_modified_time_;
76 };
77
78 } // namespace syncer
79
80 #endif // COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_PERSISTENT_BOOKMARK_ENTIT Y_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698