Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Unified Diff: sync/api/attachments/attachment_downloader.h

Issue 293143002: Add AttachmentDownloader interface, change signature of AttachmentStore::Read (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes after feedback from Nick Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sync/api/attachments/attachment_downloader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..04738992aca57168ccd1179b4ca7a0149fd51b8f
--- /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 a 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 a DownloadResult code and an Attachment object. If
+ // 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_
« no previous file with comments | « no previous file | sync/api/attachments/attachment_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698