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 COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_H_ |
6 #define COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_H_ | 6 #define COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "components/sync/api/attachments/attachment.h" | 12 #include "components/sync/api/attachments/attachment.h" |
13 #include "components/sync/base/sync_export.h" | |
14 | 13 |
15 namespace syncer { | 14 namespace syncer { |
16 | 15 |
17 class AttachmentStore; | 16 class AttachmentStore; |
18 class SyncData; | 17 class SyncData; |
19 | 18 |
20 // AttachmentService is responsible for managing a model type's attachments. | 19 // AttachmentService is responsible for managing a model type's attachments. |
21 // | 20 // |
22 // Outside of sync code, AttachmentService shouldn't be used directly. Instead | 21 // Outside of sync code, AttachmentService shouldn't be used directly. Instead |
23 // use the functionality provided by SyncData and SyncChangeProcessor. | 22 // use the functionality provided by SyncData and SyncChangeProcessor. |
24 // | 23 // |
25 // Destroying this object does not necessarily cancel outstanding async | 24 // Destroying this object does not necessarily cancel outstanding async |
26 // operations. If you need cancel like semantics, use WeakPtr in the callbacks. | 25 // operations. If you need cancel like semantics, use WeakPtr in the callbacks. |
27 class SYNC_EXPORT AttachmentService { | 26 class AttachmentService { |
28 public: | 27 public: |
29 // The result of a GetOrDownloadAttachments operation. | 28 // The result of a GetOrDownloadAttachments operation. |
30 enum GetOrDownloadResult { | 29 enum GetOrDownloadResult { |
31 GET_SUCCESS, // No error, all attachments returned. | 30 GET_SUCCESS, // No error, all attachments returned. |
32 GET_UNSPECIFIED_ERROR, // An unspecified error occurred. | 31 GET_UNSPECIFIED_ERROR, // An unspecified error occurred. |
33 }; | 32 }; |
34 | 33 |
35 typedef base::Callback<void(const GetOrDownloadResult&, | 34 typedef base::Callback<void(const GetOrDownloadResult&, |
36 std::unique_ptr<AttachmentMap> attachments)> | 35 std::unique_ptr<AttachmentMap> attachments)> |
37 GetOrDownloadCallback; | 36 GetOrDownloadCallback; |
(...skipping 29 matching lines...) Expand all Loading... |
67 // | 66 // |
68 // A request to upload attachments does not persist across restarts of Chrome. | 67 // A request to upload attachments does not persist across restarts of Chrome. |
69 // | 68 // |
70 // Invokes OnAttachmentUploaded on the Delegate (if provided). | 69 // Invokes OnAttachmentUploaded on the Delegate (if provided). |
71 virtual void UploadAttachments(const AttachmentIdList& attachment_ids) = 0; | 70 virtual void UploadAttachments(const AttachmentIdList& attachment_ids) = 0; |
72 }; | 71 }; |
73 | 72 |
74 } // namespace syncer | 73 } // namespace syncer |
75 | 74 |
76 #endif // COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_H_ | 75 #endif // COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_SERVICE_H_ |
OLD | NEW |