Infobar material design refresh: bg color
[chromium-blink-merge.git] / sync / internal_api / public / attachments / attachment_uploader.h
blob0339e67a85955cf458cea778be6e90ea8d31b474
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_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_UPLOADER_H_
6 #define SYNC_INTERNAL_API_PUBLIC_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"
14 namespace syncer {
16 // AttachmentUploader is responsible for uploading attachments to the server.
17 class SYNC_EXPORT AttachmentUploader {
18 public:
19 // The result of an UploadAttachment operation.
20 enum UploadResult {
21 UPLOAD_SUCCESS, // No error, attachment was uploaded
22 // successfully.
23 UPLOAD_TRANSIENT_ERROR, // A transient error occurred, try again later.
24 UPLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred.
27 typedef base::Callback<void(const UploadResult&, const AttachmentId&)>
28 UploadCallback;
30 AttachmentUploader();
31 virtual ~AttachmentUploader();
33 // Upload |attachment| and invoke |callback| when done.
35 // |callback| will be invoked when the operation has completed (successfully
36 // or otherwise).
38 // |callback| will receive an UploadResult code and the AttachmentId of the
39 // newly uploaded attachment.
40 virtual void UploadAttachment(const Attachment& attachment,
41 const UploadCallback& callback) = 0;
44 } // namespace syncer
46 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_UPLOADER_H_