Chromium Code Reviews| Index: sync/api/attachments/attachment_downloader.h |
| diff --git a/sync/api/attachments/attachment_downloader.h b/sync/api/attachments/attachment_downloader.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0143b20745a264e1a1698cb15ac53a4b9fe3d8c4 |
| --- /dev/null |
| +++ b/sync/api/attachments/attachment_downloader.h |
| @@ -0,0 +1,41 @@ |
| +// 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_DOWNLOADER_H_ |
| +#define SYNC_API_ATTACHMENTS_ATTACHMENT_DOWNLOADER_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 { |
| + |
| +// AttachmentDownloader is responsible for downloading attachments from server. |
| +class SYNC_EXPORT AttachmentDownloader { |
| + public: |
| + // The result of an DownloadAttachment operation. |
| + enum DownloadResult { |
| + DOWNLOAD_SUCCESS, // No error, attachment was downloaded |
| + // successfully. |
| + DOWNLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred. |
| + }; |
| + |
| + typedef base::Callback<void(const DownloadResult&, scoped_ptr<Attachment>)> |
| + DownloadCallback; |
| + |
| + virtual ~AttachmentDownloader(); |
| + |
| + // Download attachment referred by |attachment_id| and invoke |callback| when |
| + // done. |
| + // |
| + // |callback| will receive an DownloadResult code and an Attachment object. If |
|
maniscalco
2014/05/22 20:28:09
nit: "an DownloadResult" -> "a DownloadResult"
pavely
2014/05/22 21:13:33
Done.
|
| + // DownloadResult is not DOWNLOAD_SUCCESS then attachment pointer is NULL. |
| + virtual void DownloadAttachment(const AttachmentId& attachment_id, |
| + const DownloadCallback& callback) = 0; |
| +}; |
| + |
| +} // namespace syncer |
| + |
| +#endif // SYNC_API_ATTACHMENTS_ATTACHMENT_DOWNLOADER_H_ |