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

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

Issue 973513002: [Sync] Remove DropAttachments from AttachmentService and SyncData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix call count. Created 5 years, 9 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_SERVICE_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_H_
6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_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"
(...skipping 18 matching lines...) Expand all
29 // The result of a GetOrDownloadAttachments operation. 29 // The result of a GetOrDownloadAttachments operation.
30 enum GetOrDownloadResult { 30 enum GetOrDownloadResult {
31 GET_SUCCESS, // No error, all attachments returned. 31 GET_SUCCESS, // No error, all attachments returned.
32 GET_UNSPECIFIED_ERROR, // An unspecified error occurred. 32 GET_UNSPECIFIED_ERROR, // An unspecified error occurred.
33 }; 33 };
34 34
35 typedef base::Callback< 35 typedef base::Callback<
36 void(const GetOrDownloadResult&, scoped_ptr<AttachmentMap> attachments)> 36 void(const GetOrDownloadResult&, scoped_ptr<AttachmentMap> attachments)>
37 GetOrDownloadCallback; 37 GetOrDownloadCallback;
38 38
39 // The result of a DropAttachments operation.
40 enum DropResult {
41 DROP_SUCCESS, // No error, all attachments dropped.
42 DROP_UNSPECIFIED_ERROR, // An unspecified error occurred. Some or all
43 // attachments may not have been dropped.
44 };
45
46 typedef base::Callback<void(const DropResult&)> DropCallback;
47
48 // An interface that embedder code implements to be notified about different 39 // An interface that embedder code implements to be notified about different
49 // events that originate from AttachmentService. 40 // events that originate from AttachmentService.
50 // This interface will be called from the same thread AttachmentService was 41 // This interface will be called from the same thread AttachmentService was
51 // created and called. 42 // created and called.
52 class Delegate { 43 class Delegate {
53 public: 44 public:
54 virtual ~Delegate() {} 45 virtual ~Delegate() {}
55 46
56 // Attachment is uploaded to server and attachment_id is updated with server 47 // Attachment is uploaded to server and attachment_id is updated with server
57 // url. 48 // url.
58 virtual void OnAttachmentUploaded(const AttachmentId& attachment_id) = 0; 49 virtual void OnAttachmentUploaded(const AttachmentId& attachment_id) = 0;
59 }; 50 };
60 51
61 AttachmentService(); 52 AttachmentService();
62 virtual ~AttachmentService(); 53 virtual ~AttachmentService();
63 54
64 // Return a pointer to the AttachmentStore owned by this object. 55 // Return a pointer to the AttachmentStore owned by this object.
65 // 56 //
66 // May return NULL. 57 // May return NULL.
67 virtual AttachmentStore* GetStore() = 0; 58 virtual AttachmentStore* GetStore() = 0;
68 59
69 // See SyncData::GetOrDownloadAttachments. 60 // See SyncData::GetOrDownloadAttachments.
70 virtual void GetOrDownloadAttachments( 61 virtual void GetOrDownloadAttachments(
71 const AttachmentIdList& attachment_ids, 62 const AttachmentIdList& attachment_ids,
72 const GetOrDownloadCallback& callback) = 0; 63 const GetOrDownloadCallback& callback) = 0;
73 64
74 // See SyncData::DropAttachments.
75 virtual void DropAttachments(const AttachmentIdList& attachment_ids,
76 const DropCallback& callback) = 0;
77
78 // Schedules the attachments identified by |attachment_ids| to be uploaded to 65 // Schedules the attachments identified by |attachment_ids| to be uploaded to
79 // the server. 66 // the server.
80 // 67 //
81 // Assumes the attachments are already in the attachment store. 68 // Assumes the attachments are already in the attachment store.
82 // 69 //
83 // A request to upload attachments is persistent in that uploads will be 70 // A request to upload attachments is persistent in that uploads will be
84 // automatically retried if transient errors occur. 71 // automatically retried if transient errors occur.
85 // 72 //
86 // A request to upload attachments does not persist across restarts of Chrome. 73 // A request to upload attachments does not persist across restarts of Chrome.
87 // 74 //
88 // Invokes OnAttachmentUploaded on the Delegate (if provided). 75 // Invokes OnAttachmentUploaded on the Delegate (if provided).
89 virtual void UploadAttachments(const AttachmentIdSet& attachment_ids) = 0; 76 virtual void UploadAttachments(const AttachmentIdSet& attachment_ids) = 0;
90 }; 77 };
91 78
92 } // namespace syncer 79 } // namespace syncer
93 80
94 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_H_ 81 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_ATTACHMENT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698