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 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // must be valid throughout AttachmentService lifetime. | 26 // must be valid throughout AttachmentService lifetime. |
27 // | 27 // |
28 // |attachment_uploader| is optional. If null, attachments will never be | 28 // |attachment_uploader| is optional. If null, attachments will never be |
29 // uploaded to the sync server and |delegate|'s OnAttachmentUploaded will | 29 // uploaded to the sync server and |delegate|'s OnAttachmentUploaded will |
30 // never be invoked. | 30 // never be invoked. |
31 // | 31 // |
32 // |attachment_downloader| is optional. If null, attachments will never be | 32 // |attachment_downloader| is optional. If null, attachments will never be |
33 // downloaded. Only attachments in |attachment_store| will be returned from | 33 // downloaded. Only attachments in |attachment_store| will be returned from |
34 // GetOrDownloadAttachments. | 34 // GetOrDownloadAttachments. |
35 | 35 |
36 AttachmentServiceImpl(scoped_ptr<AttachmentStore> attachment_store, | 36 AttachmentServiceImpl(scoped_refptr<AttachmentStore> attachment_store, |
37 scoped_ptr<AttachmentUploader> attachment_uploader, | 37 scoped_ptr<AttachmentUploader> attachment_uploader, |
38 scoped_ptr<AttachmentDownloader> attachment_downloader, | 38 scoped_ptr<AttachmentDownloader> attachment_downloader, |
39 Delegate* delegate); | 39 Delegate* delegate); |
40 virtual ~AttachmentServiceImpl(); | 40 virtual ~AttachmentServiceImpl(); |
41 | 41 |
42 // Create an AttachmentServiceImpl suitable for use in tests. | 42 // Create an AttachmentServiceImpl suitable for use in tests. |
43 static scoped_ptr<syncer::AttachmentService> CreateForTest(); | 43 static scoped_ptr<syncer::AttachmentService> CreateForTest(); |
44 | 44 |
45 // AttachmentService implementation. | 45 // AttachmentService implementation. |
46 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, | 46 virtual void GetOrDownloadAttachments(const AttachmentIdList& attachment_ids, |
(...skipping 15 matching lines...) Expand all Loading... |
62 const AttachmentStore::Result& result); | 62 const AttachmentStore::Result& result); |
63 void WriteDone(const StoreCallback& callback, | 63 void WriteDone(const StoreCallback& callback, |
64 const AttachmentStore::Result& result); | 64 const AttachmentStore::Result& result); |
65 void UploadDone(const AttachmentUploader::UploadResult& result, | 65 void UploadDone(const AttachmentUploader::UploadResult& result, |
66 const AttachmentId& attachment_id); | 66 const AttachmentId& attachment_id); |
67 void DownloadDone(const scoped_refptr<GetOrDownloadState>& state, | 67 void DownloadDone(const scoped_refptr<GetOrDownloadState>& state, |
68 const AttachmentId& attachment_id, | 68 const AttachmentId& attachment_id, |
69 const AttachmentDownloader::DownloadResult& result, | 69 const AttachmentDownloader::DownloadResult& result, |
70 scoped_ptr<Attachment> attachment); | 70 scoped_ptr<Attachment> attachment); |
71 | 71 |
72 const scoped_ptr<AttachmentStore> attachment_store_; | 72 scoped_refptr<AttachmentStore> attachment_store_; |
73 | 73 |
74 // May be null. | 74 // May be null. |
75 const scoped_ptr<AttachmentUploader> attachment_uploader_; | 75 const scoped_ptr<AttachmentUploader> attachment_uploader_; |
76 | 76 |
77 // May be null. | 77 // May be null. |
78 const scoped_ptr<AttachmentDownloader> attachment_downloader_; | 78 const scoped_ptr<AttachmentDownloader> attachment_downloader_; |
79 | 79 |
80 // May be null. | 80 // May be null. |
81 Delegate* delegate_; | 81 Delegate* delegate_; |
82 | 82 |
83 // Must be last data member. | 83 // Must be last data member. |
84 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; | 84 base::WeakPtrFactory<AttachmentServiceImpl> weak_ptr_factory_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); | 86 DISALLOW_COPY_AND_ASSIGN(AttachmentServiceImpl); |
87 }; | 87 }; |
88 | 88 |
89 } // namespace syncer | 89 } // namespace syncer |
90 | 90 |
91 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ | 91 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_IMPL_H_ |
OLD | NEW |