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

Side by Side Diff: sync/internal_api/public/attachments/attachment_uploader.h

Issue 554743004: Update AttachmentServiceImpl to retry attachment uploads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master. Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_UPLOADER_H_
6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_UPLOADER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "sync/api/attachments/attachment.h" 11 #include "sync/api/attachments/attachment.h"
12 #include "sync/base/sync_export.h" 12 #include "sync/base/sync_export.h"
13 13
14 namespace syncer { 14 namespace syncer {
15 15
16 // AttachmentUploader is responsible for uploading attachments to the server. 16 // AttachmentUploader is responsible for uploading attachments to the server.
17 class SYNC_EXPORT AttachmentUploader { 17 class SYNC_EXPORT AttachmentUploader {
18 public: 18 public:
19 // The result of an UploadAttachment operation. 19 // The result of an UploadAttachment operation.
20 enum UploadResult { 20 enum UploadResult {
21 UPLOAD_SUCCESS, // No error, attachment was uploaded 21 UPLOAD_SUCCESS, // No error, attachment was uploaded
22 // successfully. 22 // successfully.
23 UPLOAD_TRANSIENT_ERROR, // A transient error occurred, try again later.
23 UPLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred. 24 UPLOAD_UNSPECIFIED_ERROR, // An unspecified error occurred.
24 }; 25 };
25 26
26 typedef base::Callback<void(const UploadResult&, const AttachmentId&)> 27 typedef base::Callback<void(const UploadResult&, const AttachmentId&)>
27 UploadCallback; 28 UploadCallback;
28 29
29 AttachmentUploader(); 30 AttachmentUploader();
30 virtual ~AttachmentUploader(); 31 virtual ~AttachmentUploader();
31 32
32 // Upload |attachment| and invoke |callback| when done. 33 // Upload |attachment| and invoke |callback| when done.
33 // 34 //
34 // |callback| will be invoked when the operation has completed (successfully 35 // |callback| will be invoked when the operation has completed (successfully
35 // or otherwise). 36 // or otherwise).
36 // 37 //
37 // |callback| will receive an UploadResult code and the AttachmentId of the 38 // |callback| will receive an UploadResult code and the AttachmentId of the
38 // newly uploaded attachment. 39 // newly uploaded attachment.
39 virtual void UploadAttachment(const Attachment& attachment, 40 virtual void UploadAttachment(const Attachment& attachment,
40 const UploadCallback& callback) = 0; 41 const UploadCallback& callback) = 0;
41 }; 42 };
42 43
43 } // namespace syncer 44 } // namespace syncer
44 45
45 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_UPLOADER_H_ 46 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_UPLOADER_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/attachments/attachment_service_impl.h ('k') | sync/internal_api/public/attachments/task_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698