OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ | |
6 #define COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "components/sync/api/attachments/attachment.h" | |
10 | |
11 namespace syncer { | |
12 | |
13 // AttachmentUploader is responsible for uploading attachments to the server. | |
14 class AttachmentUploader { | |
15 public: | |
16 // The result of an UploadAttachment operation. | |
17 enum UploadResult { | |
18 UPLOAD_SUCCESS, // No error, attachment was uploaded | |
19 // successfully. | |
20 UPLOAD_TRANSIENT_ERROR, // A transient error occurred, try again later. | |
21 UPLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred. | |
22 }; | |
23 | |
24 typedef base::Callback<void(const UploadResult&, const AttachmentId&)> | |
25 UploadCallback; | |
26 | |
27 AttachmentUploader(); | |
28 virtual ~AttachmentUploader(); | |
29 | |
30 // Upload |attachment| and invoke |callback| when done. | |
31 // | |
32 // |callback| will be invoked when the operation has completed (successfully | |
33 // or otherwise). | |
34 // | |
35 // |callback| will receive an UploadResult code and the AttachmentId of the | |
36 // newly uploaded attachment. | |
37 virtual void UploadAttachment(const Attachment& attachment, | |
38 const UploadCallback& callback) = 0; | |
39 }; | |
40 | |
41 } // namespace syncer | |
42 | |
43 #endif // COMPONENTS_SYNC_CORE_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ | |
OLD | NEW |