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.
5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_UPLOADER_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_UPLOADER_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "sync/api/attachments/attachment.h"
12 #include "sync/base/sync_export.h"
16 // AttachmentUploader is responsible for uploading attachments to the server.
17 class SYNC_EXPORT AttachmentUploader {
19 // The result of an UploadAttachment operation.
21 UPLOAD_SUCCESS, // No error, attachment was uploaded
23 UPLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred.
26 typedef base::Callback<void(const UploadResult&, const AttachmentId&)>
30 virtual ~AttachmentUploader();
32 // Upload |attachment| and invoke |callback| when done.
34 // |callback| will be invoked when the operation has completed (successfully
37 // |callback| will receive an UploadResult code and an updated AttachmentId
38 // containing the server address of the newly uploaded attachment.
39 virtual void UploadAttachment(const Attachment& attachment,
40 const UploadCallback& callback) = 0;
45 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_UPLOADER_H_