Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_DOWNLOADER_H_ | |
| 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_DOWNLOADER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "sync/api/attachments/attachment.h" | |
| 11 #include "sync/base/sync_export.h" | |
| 12 | |
| 13 namespace syncer { | |
| 14 | |
| 15 // AttachmentDownloader is responsible for downloading attachments from server. | |
| 16 class SYNC_EXPORT AttachmentDownloader { | |
| 17 public: | |
| 18 // The result of an DownloadAttachment operation. | |
| 19 enum DownloadResult { | |
| 20 DOWNLOAD_SUCCESS, // No error, attachment was downloaded | |
| 21 // successfully. | |
| 22 DOWNLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred. | |
| 23 }; | |
| 24 | |
| 25 typedef base::Callback<void(const DownloadResult&, scoped_ptr<Attachment>)> | |
| 26 DownloadCallback; | |
| 27 | |
| 28 virtual ~AttachmentDownloader(); | |
| 29 | |
| 30 // Download attachment referred by |attachment_id| and invoke |callback| when | |
| 31 // done. | |
| 32 // | |
| 33 // |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.
| |
| 34 // DownloadResult is not DOWNLOAD_SUCCESS then attachment pointer is NULL. | |
| 35 virtual void DownloadAttachment(const AttachmentId& attachment_id, | |
| 36 const DownloadCallback& callback) = 0; | |
| 37 }; | |
| 38 | |
| 39 } // namespace syncer | |
| 40 | |
| 41 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_DOWNLOADER_H_ | |
| OLD | NEW |