OLD | NEW |
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 SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_H_ | 5 #ifndef SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_H_ |
6 #define SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_H_ | 6 #define SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 | 12 |
11 #include "base/basictypes.h" | |
12 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
13 #include "sync/protocol/sync.pb.h" | 14 #include "sync/protocol/sync.pb.h" |
14 #include "sync/test/fake_server/fake_server_entity.h" | 15 #include "sync/test/fake_server/fake_server_entity.h" |
15 | 16 |
16 namespace fake_server { | 17 namespace fake_server { |
17 | 18 |
18 // A bookmark version of FakeServerEntity. This type represents entities that | 19 // A bookmark version of FakeServerEntity. This type represents entities that |
19 // are non-deleted, client-created, and not unique per client account. | 20 // are non-deleted, client-created, and not unique per client account. |
20 class BookmarkEntity : public FakeServerEntity { | 21 class BookmarkEntity : public FakeServerEntity { |
21 public: | 22 public: |
22 ~BookmarkEntity() override; | 23 ~BookmarkEntity() override; |
23 | 24 |
24 // Factory function for BookmarkEntity. This factory should be used only for | 25 // Factory function for BookmarkEntity. This factory should be used only for |
25 // the first time that a specific bookmark is seen by the server. | 26 // the first time that a specific bookmark is seen by the server. |
26 static scoped_ptr<FakeServerEntity> CreateNew( | 27 static scoped_ptr<FakeServerEntity> CreateNew( |
27 const sync_pb::SyncEntity& client_entity, | 28 const sync_pb::SyncEntity& client_entity, |
28 const std::string& parent_id, | 29 const std::string& parent_id, |
29 const std::string& client_guid); | 30 const std::string& client_guid); |
30 | 31 |
31 // Factory function for BookmarkEntity. The server's current entity for this | 32 // Factory function for BookmarkEntity. The server's current entity for this |
32 // ID, |current_server_entity|, is passed here because the client does not | 33 // ID, |current_server_entity|, is passed here because the client does not |
33 // always send the complete entity over the wire. This requires copying of | 34 // always send the complete entity over the wire. This requires copying of |
34 // some of the existing entity when creating a new entity. | 35 // some of the existing entity when creating a new entity. |
35 static scoped_ptr<FakeServerEntity> CreateUpdatedVersion( | 36 static scoped_ptr<FakeServerEntity> CreateUpdatedVersion( |
36 const sync_pb::SyncEntity& client_entity, | 37 const sync_pb::SyncEntity& client_entity, |
37 const FakeServerEntity& current_server_entity, | 38 const FakeServerEntity& current_server_entity, |
38 const std::string& parent_id); | 39 const std::string& parent_id); |
39 | 40 |
40 BookmarkEntity(const std::string& id, | 41 BookmarkEntity(const std::string& id, |
41 int64 version, | 42 int64_t version, |
42 const std::string& name, | 43 const std::string& name, |
43 const std::string& originator_cache_guid, | 44 const std::string& originator_cache_guid, |
44 const std::string& originator_client_item_id, | 45 const std::string& originator_client_item_id, |
45 const sync_pb::UniquePosition& unique_position, | 46 const sync_pb::UniquePosition& unique_position, |
46 const sync_pb::EntitySpecifics& specifics, | 47 const sync_pb::EntitySpecifics& specifics, |
47 bool is_folder, | 48 bool is_folder, |
48 const std::string& parent_id, | 49 const std::string& parent_id, |
49 int64 creation_time, | 50 int64_t creation_time, |
50 int64 last_modified_time); | 51 int64_t last_modified_time); |
51 | 52 |
52 void SetParentId(const std::string& parent_id); | 53 void SetParentId(const std::string& parent_id); |
53 | 54 |
54 // FakeServerEntity implementation. | 55 // FakeServerEntity implementation. |
55 bool RequiresParentId() const override; | 56 bool RequiresParentId() const override; |
56 std::string GetParentId() const override; | 57 std::string GetParentId() const override; |
57 void SerializeAsProto(sync_pb::SyncEntity* proto) const override; | 58 void SerializeAsProto(sync_pb::SyncEntity* proto) const override; |
58 bool IsFolder() const override; | 59 bool IsFolder() const override; |
59 | 60 |
60 private: | 61 private: |
61 // All member values have equivalent fields in SyncEntity. | 62 // All member values have equivalent fields in SyncEntity. |
62 std::string originator_cache_guid_; | 63 std::string originator_cache_guid_; |
63 std::string originator_client_item_id_; | 64 std::string originator_client_item_id_; |
64 sync_pb::UniquePosition unique_position_; | 65 sync_pb::UniquePosition unique_position_; |
65 bool is_folder_; | 66 bool is_folder_; |
66 std::string parent_id_; | 67 std::string parent_id_; |
67 int64 creation_time_; | 68 int64_t creation_time_; |
68 int64 last_modified_time_; | 69 int64_t last_modified_time_; |
69 }; | 70 }; |
70 | 71 |
71 } // namespace fake_server | 72 } // namespace fake_server |
72 | 73 |
73 #endif // SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_H_ | 74 #endif // SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_H_ |
OLD | NEW |