| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "components/sync/engine_impl/commit_util.h" | 5 #include "components/sync/engine_impl/commit_util.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 sync_entry->set_ctime(TimeToProtoTime(meta_entry.GetCtime())); | 159 sync_entry->set_ctime(TimeToProtoTime(meta_entry.GetCtime())); |
| 160 sync_entry->set_mtime(TimeToProtoTime(meta_entry.GetMtime())); | 160 sync_entry->set_mtime(TimeToProtoTime(meta_entry.GetMtime())); |
| 161 | 161 |
| 162 SetAttachmentIds(meta_entry, sync_entry); | 162 SetAttachmentIds(meta_entry, sync_entry); |
| 163 | 163 |
| 164 // Handle bookmarks separately. | 164 // Handle bookmarks separately. |
| 165 if (meta_entry.GetSpecifics().has_bookmark()) { | 165 if (meta_entry.GetSpecifics().has_bookmark()) { |
| 166 if (meta_entry.GetIsDel()) { | 166 if (meta_entry.GetIsDel()) { |
| 167 sync_entry->set_deleted(true); | 167 sync_entry->set_deleted(true); |
| 168 } else { | 168 } else { |
| 169 // Both insert_after_item_id and position_in_parent fields are set only | 169 // position_in_parent field is set only for legacy reasons. See comments |
| 170 // for legacy reasons. See comments in sync.proto for more information. | 170 // in sync.proto for more information. |
| 171 const Id& prev_id = meta_entry.GetPredecessorId(); | |
| 172 string prev_id_string = | |
| 173 prev_id.IsNull() ? string() : prev_id.GetServerId(); | |
| 174 sync_entry->set_insert_after_item_id(prev_id_string); | |
| 175 sync_entry->set_position_in_parent( | 171 sync_entry->set_position_in_parent( |
| 176 meta_entry.GetUniquePosition().ToInt64()); | 172 meta_entry.GetUniquePosition().ToInt64()); |
| 177 meta_entry.GetUniquePosition().ToProto( | 173 meta_entry.GetUniquePosition().ToProto( |
| 178 sync_entry->mutable_unique_position()); | 174 sync_entry->mutable_unique_position()); |
| 179 } | 175 } |
| 180 // Always send specifics for bookmarks. | 176 // Always send specifics for bookmarks. |
| 181 SetEntrySpecifics(meta_entry, sync_entry); | 177 SetEntrySpecifics(meta_entry, sync_entry); |
| 182 return; | 178 return; |
| 183 } | 179 } |
| 184 | 180 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 437 |
| 442 ProcessSuccessfulCommitResponse(commit_request_entry, server_entry, | 438 ProcessSuccessfulCommitResponse(commit_request_entry, server_entry, |
| 443 local_entry.GetId(), &local_entry, | 439 local_entry.GetId(), &local_entry, |
| 444 dirty_sync_was_set, deleted_folders); | 440 dirty_sync_was_set, deleted_folders); |
| 445 return response; | 441 return response; |
| 446 } | 442 } |
| 447 | 443 |
| 448 } // namespace commit_util | 444 } // namespace commit_util |
| 449 | 445 |
| 450 } // namespace syncer | 446 } // namespace syncer |
| OLD | NEW |