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

Side by Side Diff: sync/api/attachments/attachment_service.h

Issue 265853004: Revert of Keep track of which attachments are referenced by which sync entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/api/attachments/attachment_id.cc ('k') | sync/api/attachments/attachment_service_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_API_ATTACHMENTS_ATTACHMENT_SERVICE_H_ 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_H_
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_H_ 6 #define SYNC_API_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 20 matching lines...) Expand all
31 GET_UNSPECIFIED_ERROR, // An unspecified error occurred. 31 GET_UNSPECIFIED_ERROR, // An unspecified error occurred.
32 }; 32 };
33 33
34 typedef base::Callback< 34 typedef base::Callback<
35 void(const GetOrDownloadResult&, scoped_ptr<AttachmentMap> attachments)> 35 void(const GetOrDownloadResult&, scoped_ptr<AttachmentMap> attachments)>
36 GetOrDownloadCallback; 36 GetOrDownloadCallback;
37 37
38 // The result of a DropAttachments operation. 38 // The result of a DropAttachments operation.
39 enum DropResult { 39 enum DropResult {
40 DROP_SUCCESS, // No error, all attachments dropped. 40 DROP_SUCCESS, // No error, all attachments dropped.
41 DROP_UNSPECIFIED_ERROR, // An unspecified error occurred. Some or all 41 DROP_UNSPECIFIED_ERROR, // An unspecified error occurred.
42 // attachments may not have been dropped.
43 }; 42 };
44 43
45 typedef base::Callback<void(const DropResult&)> DropCallback; 44 typedef base::Callback<void(const DropResult&)> DropCallback;
46 45
47 // The result of a StoreAttachments operation.
48 enum StoreResult {
49 STORE_SUCCESS, // No error, all attachments stored (at least
50 // locally).
51 STORE_UNSPECIFIED_ERROR, // An unspecified error occurred. Some or all
52 // attachments may not have been stored.
53 };
54
55 typedef base::Callback<void(const StoreResult&)> StoreCallback;
56
57 AttachmentService(); 46 AttachmentService();
58 virtual ~AttachmentService(); 47 virtual ~AttachmentService();
59 48
60 // See SyncData::GetOrDownloadAttachments. 49 // See SyncData::GetOrDownloadAttachments.
61 virtual void GetOrDownloadAttachments( 50 virtual void GetOrDownloadAttachments(
62 const AttachmentIdList& attachment_ids, 51 const AttachmentIdList& attachment_ids,
63 const GetOrDownloadCallback& callback) = 0; 52 const GetOrDownloadCallback& callback) = 0;
64 53
65 // See SyncData::DropAttachments. 54 // See SyncData::DropAttachments.
66 virtual void DropAttachments(const AttachmentIdList& attachment_ids, 55 virtual void DropAttachments(const AttachmentIdList& attachment_ids,
67 const DropCallback& callback) = 0; 56 const DropCallback& callback) = 0;
68 57
69 // Store |attachments| on device and (eventually) upload them to the server. 58 // This method should be called when a SyncData is about to be added to the
70 // 59 // sync database so we have a chance to persist the Attachment locally and
71 // Invokes |callback| once the attachments have been written to device 60 // schedule it for upload to the sync server.
72 // storage. 61 virtual void OnSyncDataAdd(const SyncData& sync_data) = 0;
73 virtual void StoreAttachments(const AttachmentList& attachments,
74 const StoreCallback& callback) = 0;
75 62
76 // This method should be called when a SyncData is about to be deleted from 63 // This method should be called when a SyncData is about to be deleted from
77 // the sync database so we can remove any unreferenced attachments from local 64 // the sync database so we can remove any unreferenced attachments from local
78 // storage. 65 // storage.
79 virtual void OnSyncDataDelete(const SyncData& sync_data) = 0; 66 virtual void OnSyncDataDelete(const SyncData& sync_data) = 0;
80 67
81 // This method should be called when a SyncData is about to be updated so we 68 // This method should be called when a SyncData is about to be updated so we
82 // can remove unreferenced attachments from local storage and ensure new 69 // can remove unreferenced attachments from local storage and ensure new
83 // attachments are persisted and uploaded to the sync server. 70 // attachments are persisted and uploaded to the sync server.
84 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids, 71 virtual void OnSyncDataUpdate(const AttachmentIdList& old_attachment_ids,
85 const SyncData& updated_sync_data) = 0; 72 const SyncData& updated_sync_data) = 0;
86 }; 73 };
87 74
88 } // namespace syncer 75 } // namespace syncer
89 76
90 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_H_ 77 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_SERVICE_H_
OLDNEW
« no previous file with comments | « sync/api/attachments/attachment_id.cc ('k') | sync/api/attachments/attachment_service_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698