blob: 0339e67a85955cf458cea778be6e90ea8d31b474 [file] [log] [blame]
// 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.
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/scoped_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 {
// The result of an UploadAttachment operation.
enum UploadResult {
UPLOAD_SUCCESS, // No error, attachment was uploaded
// successfully.
UPLOAD_TRANSIENT_ERROR, // A transient error occurred, try again later.
UPLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred.
typedef base::Callback<void(const UploadResult&, const AttachmentId&)>
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 the AttachmentId of the
// newly uploaded attachment.
virtual void UploadAttachment(const Attachment& attachment,
const UploadCallback& callback) = 0;
} // namespace syncer