OLD | NEW |
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_STORE_H_ | 5 #ifndef SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ |
6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ | 6 #define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "sync/base/sync_export.h" | 11 #include "sync/base/sync_export.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class RefCountedMemory; | 14 class RefCountedMemory; |
15 } // namespace base | 15 } // namespace base |
16 | 16 |
17 namespace syncer { | 17 namespace syncer { |
18 | 18 |
19 class Attachment; | 19 class Attachment; |
20 class AttachmentId; | 20 class AttachmentId; |
21 | 21 |
22 // A place to locally store and access Attachments. | 22 // A place to locally store and access Attachments. |
23 class SYNC_EXPORT AttachmentStore { | 23 class SYNC_EXPORT AttachmentStore { |
24 public: | 24 public: |
25 AttachmentStore(); | 25 AttachmentStore(); |
26 virtual ~AttachmentStore(); | 26 virtual ~AttachmentStore(); |
27 | 27 |
28 // TODO(maniscalco): Consider udpating Read and Write methods to support | 28 // TODO(maniscalco): Consider udpating Read and Write methods to support |
29 // resumable transfers. | 29 // resumable transfers (bug 353292). |
30 | 30 |
31 enum Result { | 31 enum Result { |
32 SUCCESS, // No error. | 32 SUCCESS, // No error. |
33 NOT_FOUND, // Attachment was not found or does not exist. | 33 NOT_FOUND, // Attachment was not found or does not exist. |
34 UNSPECIFIED_ERROR, // An unspecified error occurred. | 34 UNSPECIFIED_ERROR, // An unspecified error occurred. |
35 }; | 35 }; |
36 | 36 |
37 typedef base::Callback<void(const Result&, scoped_ptr<Attachment>)> | 37 typedef base::Callback<void(const Result&, scoped_ptr<Attachment>)> |
38 ReadCallback; | 38 ReadCallback; |
39 typedef base::Callback<void(const Result&, const AttachmentId& id)> | 39 typedef base::Callback<void(const Result&, const AttachmentId& id)> |
(...skipping 17 matching lines...) Expand all Loading... |
57 // | 57 // |
58 // This does not remove the attachment from the server. |callback| will be | 58 // This does not remove the attachment from the server. |callback| will be |
59 // invoked when finished. If the attachment does not exist, |callback|'s | 59 // invoked when finished. If the attachment does not exist, |callback|'s |
60 // Result will be NOT_FOUND. | 60 // Result will be NOT_FOUND. |
61 virtual void Drop(const AttachmentId& id, const DropCallback& callback) = 0; | 61 virtual void Drop(const AttachmentId& id, const DropCallback& callback) = 0; |
62 }; | 62 }; |
63 | 63 |
64 } // namespace syncer | 64 } // namespace syncer |
65 | 65 |
66 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ | 66 #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ |
OLD | NEW |