Index: sync/api/attachments/attachment_uploader.h |
diff --git a/sync/api/attachments/attachment_uploader.h b/sync/api/attachments/attachment_uploader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..325a9e7d1f5836547dcc02a43df836880d240256 |
--- /dev/null |
+++ b/sync/api/attachments/attachment_uploader.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ |
+#define SYNC_API_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/callback.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+#include "sync/api/attachments/attachment.h" |
+#include "sync/base/sync_export.h" |
+ |
+namespace syncer { |
+ |
+// AttachmentUploader is responsible for uploading attachments to the server. |
+class SYNC_EXPORT AttachmentUploader { |
+ public: |
+ // The result of an UploadAttachment operation. |
+ enum UploadResult { |
+ UPLOAD_SUCCESS, // No error, attachment was uploaded |
+ // successfully. |
+ UPLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred. |
+ }; |
+ |
+ typedef base::Callback<void(const UploadResult&, const AttachmentId&)> |
+ UploadCallback; |
+ |
+ AttachmentUploader(); |
+ virtual ~AttachmentUploader(); |
+ |
+ // Upload |attachment| and invoke |callback| when done. |
+ // |
+ // |callback| will be invoked when the operation has completed (successfully |
+ // or otherwise). |
+ // |
+ // |callback| will receive an UploadResult code and an updated AttachmentId |
+ // |containing the server address of the newly uploaded attachment. |
+ virtual void UploadAttachment(const Attachment& attachment, |
+ const UploadCallback& callback) = 0; |
+}; |
+ |
+} // namespace syncer |
+ |
+#endif // SYNC_API_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ |