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_MODEL_ATTACHMENTS_ATTACHMENT_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_SERVICE_H_ |
6 #define COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_SERVICE_H_ | 6 #define COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_SERVICE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // Destroying this object does not necessarily cancel outstanding async | 26 // Destroying this object does not necessarily cancel outstanding async |
27 // operations. If you need cancel like semantics, use WeakPtr in the callbacks. | 27 // operations. If you need cancel like semantics, use WeakPtr in the callbacks. |
28 class AttachmentService { | 28 class AttachmentService { |
29 public: | 29 public: |
30 // The result of a GetOrDownloadAttachments operation. | 30 // The result of a GetOrDownloadAttachments operation. |
31 enum GetOrDownloadResult { | 31 enum GetOrDownloadResult { |
32 GET_SUCCESS, // No error, all attachments returned. | 32 GET_SUCCESS, // No error, all attachments returned. |
33 GET_UNSPECIFIED_ERROR, // An unspecified error occurred. | 33 GET_UNSPECIFIED_ERROR, // An unspecified error occurred. |
34 }; | 34 }; |
35 | 35 |
36 typedef base::Callback<void(const GetOrDownloadResult&, | 36 using GetOrDownloadCallback = |
37 std::unique_ptr<AttachmentMap> attachments)> | 37 base::Callback<void(const GetOrDownloadResult&, |
38 GetOrDownloadCallback; | 38 std::unique_ptr<AttachmentMap> attachments)>; |
39 | 39 |
40 // An interface that embedder code implements to be notified about different | 40 // An interface that embedder code implements to be notified about different |
41 // events that originate from AttachmentService. | 41 // events that originate from AttachmentService. |
42 // This interface will be called from the same thread AttachmentService was | 42 // This interface will be called from the same thread AttachmentService was |
43 // created and called. | 43 // created and called. |
44 class Delegate { | 44 class Delegate { |
45 public: | 45 public: |
46 virtual ~Delegate() {} | 46 virtual ~Delegate() {} |
47 | 47 |
48 // Attachment is uploaded to server and attachment_id is updated with server | 48 // Attachment is uploaded to server and attachment_id is updated with server |
(...skipping 30 matching lines...) Expand all Loading... |
79 // | 79 // |
80 // A request to upload attachments does not persist across restarts of Chrome. | 80 // A request to upload attachments does not persist across restarts of Chrome. |
81 // | 81 // |
82 // Invokes OnAttachmentUploaded on the Delegate (if provided). | 82 // Invokes OnAttachmentUploaded on the Delegate (if provided). |
83 virtual void UploadAttachments(const AttachmentIdList& attachment_ids) = 0; | 83 virtual void UploadAttachments(const AttachmentIdList& attachment_ids) = 0; |
84 }; | 84 }; |
85 | 85 |
86 } // namespace syncer | 86 } // namespace syncer |
87 | 87 |
88 #endif // COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_SERVICE_H_ | 88 #endif // COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_SERVICE_H_ |
OLD | NEW |