Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: sync/api/attachments/attachment_service_impl.cc

Issue 293143002: Add AttachmentDownloader interface, change signature of AttachmentStore::Read (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes after feedback from Nick Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/api/attachments/attachment_service_impl.h ('k') | sync/api/attachments/attachment_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/api/attachments/attachment_service_impl.h" 5 #include "sync/api/attachments/attachment_service_impl.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 "sync/api/attachments/attachment.h" 9 #include "sync/api/attachments/attachment.h"
10 #include "sync/internal_api/public/attachments/fake_attachment_store.h" 10 #include "sync/internal_api/public/attachments/fake_attachment_store.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void AttachmentServiceImpl::OnSyncDataUpdate( 88 void AttachmentServiceImpl::OnSyncDataUpdate(
89 const AttachmentIdList& old_attachment_ids, 89 const AttachmentIdList& old_attachment_ids,
90 const SyncData& updated_sync_data) { 90 const SyncData& updated_sync_data) {
91 DCHECK(CalledOnValidThread()); 91 DCHECK(CalledOnValidThread());
92 // TODO(maniscalco): At this point we need to ensure we write all new 92 // TODO(maniscalco): At this point we need to ensure we write all new
93 // attachments referenced by updated_sync_data to local storage and schedule 93 // attachments referenced by updated_sync_data to local storage and schedule
94 // them up upload to the server. We also need to remove any no unreferenced 94 // them up upload to the server. We also need to remove any no unreferenced
95 // attachments from local storage (bug 356351). 95 // attachments from local storage (bug 356351).
96 } 96 }
97 97
98 void AttachmentServiceImpl::ReadDone(const GetOrDownloadCallback& callback, 98 void AttachmentServiceImpl::ReadDone(
99 const AttachmentStore::Result& result, 99 const GetOrDownloadCallback& callback,
100 scoped_ptr<AttachmentMap> attachments) { 100 const AttachmentStore::Result& result,
101 scoped_ptr<AttachmentMap> attachments,
102 scoped_ptr<AttachmentIdList> unavailable_attachment_ids) {
101 AttachmentService::GetOrDownloadResult get_result = 103 AttachmentService::GetOrDownloadResult get_result =
102 AttachmentService::GET_UNSPECIFIED_ERROR; 104 AttachmentService::GET_UNSPECIFIED_ERROR;
103 if (result == AttachmentStore::SUCCESS) { 105 if (result == AttachmentStore::SUCCESS) {
104 get_result = AttachmentService::GET_SUCCESS; 106 get_result = AttachmentService::GET_SUCCESS;
105 } 107 }
106 // TODO(maniscalco): Deal with case where an error occurred (bug 361251). 108 // TODO(maniscalco): Deal with case where an error occurred (bug 361251).
107 base::MessageLoop::current()->PostTask( 109 base::MessageLoop::current()->PostTask(
108 FROM_HERE, base::Bind(callback, get_result, base::Passed(&attachments))); 110 FROM_HERE, base::Bind(callback, get_result, base::Passed(&attachments)));
109 } 111 }
110 112
(...skipping 26 matching lines...) Expand all
137 const AttachmentId& attachment_id) { 139 const AttachmentId& attachment_id) {
138 // TODO(pavely): crbug/372622: Deal with UploadAttachment failures. 140 // TODO(pavely): crbug/372622: Deal with UploadAttachment failures.
139 if (result != AttachmentUploader::UPLOAD_SUCCESS) 141 if (result != AttachmentUploader::UPLOAD_SUCCESS)
140 return; 142 return;
141 if (delegate_) { 143 if (delegate_) {
142 delegate_->OnAttachmentUploaded(attachment_id); 144 delegate_->OnAttachmentUploaded(attachment_id);
143 } 145 }
144 } 146 }
145 147
146 } // namespace syncer 148 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_service_impl.h ('k') | sync/api/attachments/attachment_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698