Index: sync/api/attachments/fake_attachment_service.cc |
diff --git a/sync/api/attachments/fake_attachment_service.cc b/sync/api/attachments/fake_attachment_service.cc |
index 8e9e867f9ada7acde10079892cfde7cf2ff3a298..609c046a39598a91d00a497b73317933fe11b9e5 100644 |
--- a/sync/api/attachments/fake_attachment_service.cc |
+++ b/sync/api/attachments/fake_attachment_service.cc |
@@ -53,10 +53,15 @@ void FakeAttachmentService::DropAttachments( |
callback)); |
} |
-void FakeAttachmentService::OnSyncDataAdd(const SyncData& sync_data) { |
+void FakeAttachmentService::StoreAttachments(const AttachmentList& attachments, |
+ const StoreCallback& callback) { |
DCHECK(CalledOnValidThread()); |
- // TODO(maniscalco): Ensure the linked attachments get persisted in local |
- // storage and schedule them for upload to the server (bug 356351). |
+ attachment_store_->Write(attachments, |
+ base::Bind(&FakeAttachmentService::WriteDone, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ callback)); |
+ // TODO(maniscalco): Ensure the linked attachments are schedule for upload to |
+ // the server (bug 356351). |
} |
void FakeAttachmentService::OnSyncDataDelete(const SyncData& sync_data) { |
@@ -101,4 +106,16 @@ void FakeAttachmentService::DropDone(const DropCallback& callback, |
base::Bind(callback, drop_result)); |
} |
+void FakeAttachmentService::WriteDone(const StoreCallback& callback, |
+ const AttachmentStore::Result& result) { |
+ AttachmentService::StoreResult store_result = |
+ AttachmentService::STORE_UNSPECIFIED_ERROR; |
+ if (result == AttachmentStore::SUCCESS) { |
+ store_result = AttachmentService::STORE_SUCCESS; |
+ } |
+ // TODO(maniscalco): Deal with case where an error occurred (bug 361251). |
+ base::MessageLoop::current()->PostTask(FROM_HERE, |
+ base::Bind(callback, store_result)); |
+} |
+ |
} // namespace syncer |