OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_ENGINE_SYNCER_PROTO_UTIL_H_ | 5 #ifndef SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
6 #define SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 6 #define SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Returns true on success. Also handles store birthday verification: will | 51 // Returns true on success. Also handles store birthday verification: will |
52 // produce a SyncError if the birthday is incorrect. | 52 // produce a SyncError if the birthday is incorrect. |
53 // NOTE: This will add all fields that must be sent on every request, which | 53 // NOTE: This will add all fields that must be sent on every request, which |
54 // includes store birthday, protocol version, client chips, api keys, etc. | 54 // includes store birthday, protocol version, client chips, api keys, etc. |
55 static SyncerError PostClientToServerMessage( | 55 static SyncerError PostClientToServerMessage( |
56 sync_pb::ClientToServerMessage* msg, | 56 sync_pb::ClientToServerMessage* msg, |
57 sync_pb::ClientToServerResponse* response, | 57 sync_pb::ClientToServerResponse* response, |
58 sessions::SyncSession* session, | 58 sessions::SyncSession* session, |
59 ModelTypeSet* partial_failure_data_types); | 59 ModelTypeSet* partial_failure_data_types); |
60 | 60 |
| 61 // Specifies where entity's position should be updated from the data in |
| 62 // GetUpdates message. |
61 static bool ShouldMaintainPosition(const sync_pb::SyncEntity& sync_entity); | 63 static bool ShouldMaintainPosition(const sync_pb::SyncEntity& sync_entity); |
62 | 64 |
| 65 // Specifies where entity's parent ID should be updated from the data in |
| 66 // GetUpdates message. |
| 67 static bool ShouldMaintainHierarchy(const sync_pb::SyncEntity& sync_entity); |
| 68 |
63 // Extract the name field from a sync entity. | 69 // Extract the name field from a sync entity. |
64 static const std::string& NameFromSyncEntity( | 70 static const std::string& NameFromSyncEntity( |
65 const sync_pb::SyncEntity& entry); | 71 const sync_pb::SyncEntity& entry); |
66 | 72 |
67 // Extract the name field from a commit entry response. | 73 // Extract the name field from a commit entry response. |
68 static const std::string& NameFromCommitEntryResponse( | 74 static const std::string& NameFromCommitEntryResponse( |
69 const sync_pb::CommitResponse_EntryResponse& entry); | 75 const sync_pb::CommitResponse_EntryResponse& entry); |
70 | 76 |
71 // Persist the bag of chips if it is present in the response. | 77 // Persist the bag of chips if it is present in the response. |
72 static void PersistBagOfChips( | 78 static void PersistBagOfChips( |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); | 137 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, VerifyResponseBirthday); |
132 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); | 138 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingNoDatatypes); |
133 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); | 139 FRIEND_TEST_ALL_PREFIXES(SyncerProtoUtilTest, HandleThrottlingWithDatatypes); |
134 | 140 |
135 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); | 141 DISALLOW_COPY_AND_ASSIGN(SyncerProtoUtil); |
136 }; | 142 }; |
137 | 143 |
138 } // namespace syncer | 144 } // namespace syncer |
139 | 145 |
140 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ | 146 #endif // SYNC_ENGINE_SYNCER_PROTO_UTIL_H_ |
OLD | NEW |