| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sync/internal_api/public/attachments/attachment_service_proxy.h" | 5 #include "sync/internal_api/public/attachments/attachment_service_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner, | 42 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner, |
| 43 const scoped_refptr<Core>& core) | 43 const scoped_refptr<Core>& core) |
| 44 : wrapped_task_runner_(wrapped_task_runner), core_(core) { | 44 : wrapped_task_runner_(wrapped_task_runner), core_(core) { |
| 45 DCHECK(wrapped_task_runner_.get()); | 45 DCHECK(wrapped_task_runner_.get()); |
| 46 DCHECK(core_.get()); | 46 DCHECK(core_.get()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 AttachmentServiceProxy::~AttachmentServiceProxy() { | 49 AttachmentServiceProxy::~AttachmentServiceProxy() { |
| 50 } | 50 } |
| 51 | 51 |
| 52 AttachmentStore* AttachmentServiceProxy::GetStore() { | |
| 53 return NULL; | |
| 54 } | |
| 55 | |
| 56 void AttachmentServiceProxy::GetOrDownloadAttachments( | 52 void AttachmentServiceProxy::GetOrDownloadAttachments( |
| 57 const AttachmentIdList& attachment_ids, | 53 const AttachmentIdList& attachment_ids, |
| 58 const GetOrDownloadCallback& callback) { | 54 const GetOrDownloadCallback& callback) { |
| 59 DCHECK(wrapped_task_runner_.get()); | 55 DCHECK(wrapped_task_runner_.get()); |
| 60 GetOrDownloadCallback proxy_callback = | 56 GetOrDownloadCallback proxy_callback = |
| 61 base::Bind(&ProxyGetOrDownloadCallback, | 57 base::Bind(&ProxyGetOrDownloadCallback, |
| 62 base::ThreadTaskRunnerHandle::Get(), | 58 base::ThreadTaskRunnerHandle::Get(), |
| 63 callback); | 59 callback); |
| 64 wrapped_task_runner_->PostTask( | 60 wrapped_task_runner_->PostTask( |
| 65 FROM_HERE, | 61 FROM_HERE, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 } | 74 } |
| 79 | 75 |
| 80 AttachmentServiceProxy::Core::Core( | 76 AttachmentServiceProxy::Core::Core( |
| 81 const base::WeakPtr<syncer::AttachmentService>& wrapped) | 77 const base::WeakPtr<syncer::AttachmentService>& wrapped) |
| 82 : wrapped_(wrapped) { | 78 : wrapped_(wrapped) { |
| 83 } | 79 } |
| 84 | 80 |
| 85 AttachmentServiceProxy::Core::~Core() { | 81 AttachmentServiceProxy::Core::~Core() { |
| 86 } | 82 } |
| 87 | 83 |
| 88 AttachmentStore* AttachmentServiceProxy::Core::GetStore() { | |
| 89 return NULL; | |
| 90 } | |
| 91 | |
| 92 void AttachmentServiceProxy::Core::GetOrDownloadAttachments( | 84 void AttachmentServiceProxy::Core::GetOrDownloadAttachments( |
| 93 const AttachmentIdList& attachment_ids, | 85 const AttachmentIdList& attachment_ids, |
| 94 const GetOrDownloadCallback& callback) { | 86 const GetOrDownloadCallback& callback) { |
| 95 if (!wrapped_) { | 87 if (!wrapped_) { |
| 96 return; | 88 return; |
| 97 } | 89 } |
| 98 wrapped_->GetOrDownloadAttachments(attachment_ids, callback); | 90 wrapped_->GetOrDownloadAttachments(attachment_ids, callback); |
| 99 } | 91 } |
| 100 | 92 |
| 101 void AttachmentServiceProxy::Core::UploadAttachments( | 93 void AttachmentServiceProxy::Core::UploadAttachments( |
| 102 const AttachmentIdSet& attachment_ids) { | 94 const AttachmentIdSet& attachment_ids) { |
| 103 if (!wrapped_) { | 95 if (!wrapped_) { |
| 104 return; | 96 return; |
| 105 } | 97 } |
| 106 wrapped_->UploadAttachments(attachment_ids); | 98 wrapped_->UploadAttachments(attachment_ids); |
| 107 } | 99 } |
| 108 | 100 |
| 109 } // namespace syncer | 101 } // namespace syncer |
| OLD | NEW |