summaryrefslogtreecommitdiffstats
path: root/sync/api/attachments/attachment_service_proxy.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sync/api/attachments/attachment_service_proxy.cc')
-rw-r--r--sync/api/attachments/attachment_service_proxy.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/sync/api/attachments/attachment_service_proxy.cc b/sync/api/attachments/attachment_service_proxy.cc
index 9bc40e5..6590033 100644
--- a/sync/api/attachments/attachment_service_proxy.cc
+++ b/sync/api/attachments/attachment_service_proxy.cc
@@ -35,6 +35,15 @@ void ProxyDropCallback(
task_runner->PostTask(FROM_HERE, base::Bind(callback, result));
}
+// Invokes |callback| with |result| and |attachments| in the |task_runner|
+// thread.
+void ProxyStoreCallback(
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ const AttachmentService::StoreCallback& callback,
+ const AttachmentService::StoreResult& result) {
+ task_runner->PostTask(FROM_HERE, base::Bind(callback, result));
+}
+
} // namespace
AttachmentServiceProxy::AttachmentServiceProxy() {
@@ -85,11 +94,17 @@ void AttachmentServiceProxy::DropAttachments(
proxy_callback));
}
-void AttachmentServiceProxy::OnSyncDataAdd(const SyncData& sync_data) {
+void AttachmentServiceProxy::StoreAttachments(const AttachmentList& attachments,
+ const StoreCallback& callback) {
DCHECK(wrapped_task_runner_);
+ StoreCallback proxy_callback = base::Bind(
+ &ProxyStoreCallback, base::MessageLoopProxy::current(), callback);
wrapped_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&AttachmentService::OnSyncDataAdd, core_, sync_data));
+ base::Bind(&AttachmentService::StoreAttachments,
+ core_,
+ attachments,
+ proxy_callback));
}
void AttachmentServiceProxy::OnSyncDataDelete(const SyncData& sync_data) {
@@ -137,11 +152,13 @@ void AttachmentServiceProxy::Core::DropAttachments(
wrapped_->DropAttachments(attachment_ids, callback);
}
-void AttachmentServiceProxy::Core::OnSyncDataAdd(const SyncData& sync_data) {
+void AttachmentServiceProxy::Core::StoreAttachments(
+ const AttachmentList& attachments,
+ const StoreCallback& callback) {
if (!wrapped_) {
return;
}
- wrapped_->OnSyncDataAdd(sync_data);
+ wrapped_->StoreAttachments(attachments, callback);
}
void AttachmentServiceProxy::Core::OnSyncDataDelete(const SyncData& sync_data) {