Index: sync/engine/commit_util.cc |
diff --git a/sync/engine/commit_util.cc b/sync/engine/commit_util.cc |
index ad29e4f40dda11a2b46b8f04ddfe1493d03d92a9..c913edd11108c99e159fee7a7ad6536356facf1d 100644 |
--- a/sync/engine/commit_util.cc |
+++ b/sync/engine/commit_util.cc |
@@ -11,6 +11,7 @@ |
#include "base/strings/string_util.h" |
#include "sync/engine/syncer_proto_util.h" |
+#include "sync/internal_api/public/base/attachment_id_proto.h" |
#include "sync/internal_api/public/base/unique_position.h" |
#include "sync/protocol/bookmark_specifics.pb.h" |
#include "sync/protocol/sync.pb.h" |
@@ -83,6 +84,7 @@ void AddClientConfigParamsToMessage( |
} |
namespace { |
+ |
void SetEntrySpecifics(const Entry& meta_entry, |
sync_pb::SyncEntity* sync_entry) { |
// Add the new style extension and the folder bit. |
@@ -92,6 +94,16 @@ void SetEntrySpecifics(const Entry& meta_entry, |
CHECK(!sync_entry->specifics().password().has_client_only_encrypted_data()); |
DCHECK_EQ(meta_entry.GetModelType(), GetModelType(*sync_entry)); |
} |
+ |
+void SetAttachmentIds(const Entry& meta_entry, |
+ sync_pb::SyncEntity* sync_entry) { |
+ const sync_pb::AttachmentMetadata& attachment_metadata = |
+ meta_entry.GetAttachmentMetadata(); |
+ for (int i = 0; i < attachment_metadata.record_size(); ++i) { |
+ *sync_entry->add_attachment_id() = attachment_metadata.record(i).id(); |
+ } |
+} |
+ |
} // namespace |
void BuildCommitItem( |
@@ -161,6 +173,8 @@ void BuildCommitItem( |
sync_entry->set_ctime(TimeToProtoTime(meta_entry.GetCtime())); |
sync_entry->set_mtime(TimeToProtoTime(meta_entry.GetMtime())); |
+ SetAttachmentIds(meta_entry, sync_entry); |
+ |
// Handle bookmarks separately. |
if (meta_entry.GetSpecifics().has_bookmark()) { |
if (meta_entry.GetIsDel()) { |
@@ -305,6 +319,8 @@ void UpdateServerFieldsAfterCommit( |
(committed_entry.folder() || |
committed_entry.bookmarkdata().bookmark_folder())); |
local_entry->PutServerSpecifics(committed_entry.specifics()); |
+ local_entry->PutServerAttachmentMetadata( |
+ CreateAttachmentMetadata(committed_entry.attachment_id())); |
local_entry->PutServerMtime(ProtoTimeToTime(committed_entry.mtime())); |
local_entry->PutServerCtime(ProtoTimeToTime(committed_entry.ctime())); |
if (committed_entry.has_unique_position()) { |