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

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

Issue 272043002: Invoke AttachmentUploader and update AttachmentIds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initialize through SyncApiComponentFactory 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
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 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/threading/non_thread_safe.h" 9 #include "base/threading/non_thread_safe.h"
10 #include "sync/api/attachments/attachment_service.h" 10 #include "sync/api/attachments/attachment_service.h"
11 #include "sync/api/attachments/attachment_service_proxy.h" 11 #include "sync/api/attachments/attachment_service_proxy.h"
12 #include "sync/api/attachments/attachment_store.h" 12 #include "sync/api/attachments/attachment_store.h"
13 #include "sync/api/attachments/attachment_uploader.h" 13 #include "sync/api/attachments/attachment_uploader.h"
14 14
15 namespace syncer { 15 namespace syncer {
16 16
17 // Implementation of AttachmentService. 17 // Implementation of AttachmentService.
18 class SYNC_EXPORT AttachmentServiceImpl : public AttachmentService, 18 class SYNC_EXPORT AttachmentServiceImpl : public AttachmentService,
19 public base::NonThreadSafe { 19 public base::NonThreadSafe {
20 public: 20 public:
21 AttachmentServiceImpl(scoped_ptr<AttachmentStore> attachment_store, 21 AttachmentServiceImpl(scoped_ptr<AttachmentStore> attachment_store,
22 scoped_ptr<AttachmentUploader> attachment_uploader); 22 scoped_ptr<AttachmentUploader> attachment_uploader,
23 Delegate* delegate);
maniscalco 2014/05/15 20:09:28 Can you please document the delegate parameter? W
pavely 2014/05/16 00:19:10 Done.
23 virtual ~AttachmentServiceImpl(); 24 virtual ~AttachmentServiceImpl();
24 25
25 // Create an AttachmentServiceImpl suitable for use in tests. 26 // Create an AttachmentServiceImpl suitable for use in tests.
26 static scoped_ptr<syncer::AttachmentService> CreateForTest(); 27 static scoped_ptr<syncer::AttachmentService> CreateForTest();
27 28
28 // AttachmentService implementation. 29 // AttachmentService implementation.
29 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, 30 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids,
30 const GetOrDownloadCallback& callback) 31 const GetOrDownloadCallback& callback)
31 OVERRIDE; 32 OVERRIDE;
32 virtual void DropAttachments(const AttachmentIdList& attachment_ids, 33 virtual void DropAttachments(const AttachmentIdList& attachment_ids,
33 const DropCallback& callback) OVERRIDE; 34 const DropCallback& callback) OVERRIDE;
34 virtual void StoreAttachments(const AttachmentList& attachments, 35 virtual void StoreAttachments(const AttachmentList& attachments,
35 const StoreCallback& callback) OVERRIDE; 36 const StoreCallback& callback) OVERRIDE;
36 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE; 37 virtual void OnSyncDataDelete(const SyncData& sync_data) OVERRIDE;
37 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids, 38 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids,
38 const SyncData& updated_sync_data) OVERRIDE; 39 const SyncData& updated_sync_data) OVERRIDE;
39 40
40 private: 41 private:
41 void ReadDone(const GetOrDownloadCallback& callback, 42 void ReadDone(const GetOrDownloadCallback& callback,
42 const AttachmentStore::Result& result, 43 const AttachmentStore::Result& result,
43 scoped_ptr<AttachmentMap> attachments); 44 scoped_ptr<AttachmentMap> attachments);
44 void DropDone(const DropCallback& callback, 45 void DropDone(const DropCallback& callback,
45 const AttachmentStore::Result& result); 46 const AttachmentStore::Result& result);
46 void WriteDone(const StoreCallback& callback, 47 void WriteDone(const StoreCallback& callback,
47 const AttachmentStore::Result& result); 48 const AttachmentStore::Result& result);
49 void UploadDone(const AttachmentUploader::UploadResult& result,
50 const AttachmentId& attachment_id);
48 51
49 const scoped_ptr<AttachmentStore> attachment_store_; 52 const scoped_ptr<AttachmentStore> attachment_store_;
50 const scoped_ptr<AttachmentUploader> attachment_uploader_; 53 const scoped_ptr<AttachmentUploader> attachment_uploader_;
54 Delegate* delegate_;
51 // Must be last data member. 55 // Must be last data member.
52 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; 56 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_;
53 57
54 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); 58 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl);
55 }; 59 };
56 60
57 } // namespace syncer 61 } // namespace syncer
58 62
59 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ 63 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698