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 b9eb88ec928ad9f2f15233b5749890f7aa647deb..5cb01e5d1ba3ec01b7968e4a514db4cab785ba49 100644 |
--- a/sync/api/attachments/fake_attachment_service.cc |
+++ b/sync/api/attachments/fake_attachment_service.cc |
@@ -51,10 +51,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) { |
@@ -99,4 +104,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 |