OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_SYNCABLE_SERVICE_H_ | 5 #ifndef SYNC_API_SYNCABLE_SERVICE_H_ |
6 #define SYNC_API_SYNCABLE_SERVICE_H_ | 6 #define SYNC_API_SYNCABLE_SERVICE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 virtual void StopSyncing(ModelType type) = 0; | 59 virtual void StopSyncing(ModelType type) = 0; |
60 | 60 |
61 // SyncChangeProcessor interface. | 61 // SyncChangeProcessor interface. |
62 // Process a list of new SyncChanges and update the local data as necessary. | 62 // Process a list of new SyncChanges and update the local data as necessary. |
63 // Returns: A default SyncError (IsSet() == false) if no errors were | 63 // Returns: A default SyncError (IsSet() == false) if no errors were |
64 // encountered, and a filled SyncError (IsSet() == true) | 64 // encountered, and a filled SyncError (IsSet() == true) |
65 // otherwise. | 65 // otherwise. |
66 SyncError ProcessSyncChanges(const tracked_objects::Location& from_here, | 66 SyncError ProcessSyncChanges(const tracked_objects::Location& from_here, |
67 const SyncChangeList& change_list) override = 0; | 67 const SyncChangeList& change_list) override = 0; |
68 | 68 |
69 // Returns AttachmentStore used by datatype. Attachment store is used by sync | 69 // Returns AttachmentStore for use by sync when uploading or downloading |
70 // when uploading or downloading attachments. | 70 // attachments. |
71 // GetAttachmentStore is called right before MergeDataAndStartSyncing. If at | 71 // GetAttachmentStore is called right before MergeDataAndStartSyncing. If at |
72 // that time GetAttachmentStore returns NULL then datatype is considered not | 72 // that time GetAttachmentStore returns NULL then datatype is considered not |
73 // using attachments and all attempts to upload/download attachments will | 73 // using attachments and all attempts to upload/download attachments will |
74 // fail. Default implementation returns NULL. Datatype that uses sync | 74 // fail. Default implementation returns NULL. Datatype that uses sync |
75 // attachemnts should create attachment store and implement GetAttachmentStore | 75 // attachments should create attachment store, implement GetAttachmentStore |
76 // to return pointer to it. | 76 // to return result of AttachmentStore::CreateAttachmentStoreForSync() from |
77 virtual scoped_refptr<AttachmentStore> GetAttachmentStore(); | 77 // attachment store object. |
| 78 virtual scoped_ptr<AttachmentStore> GetAttachmentStoreForSync(); |
78 | 79 |
79 // Called by sync to provide AttachmentService to be used to download | 80 // Called by sync to provide AttachmentService to be used to download |
80 // attachments. | 81 // attachments. |
81 // SetAttachmentService is called after GetAttachmentStore and right before | 82 // SetAttachmentService is called after GetAttachmentStore and right before |
82 // MergeDataAndStartSyncing and only if GetAttachmentStore has returned a | 83 // MergeDataAndStartSyncing and only if GetAttachmentStore has returned a |
83 // non-NULL store instance. Default implementation does nothing. | 84 // non-NULL store instance. Default implementation does nothing. |
84 // Datatype that uses attachments must take ownerhip of the provided | 85 // Datatype that uses attachments must take ownerhip of the provided |
85 // AttachmentService instance. | 86 // AttachmentService instance. |
86 virtual void SetAttachmentService( | 87 virtual void SetAttachmentService( |
87 scoped_ptr<AttachmentService> attachment_service); | 88 scoped_ptr<AttachmentService> attachment_service); |
88 | 89 |
89 protected: | 90 protected: |
90 ~SyncableService() override; | 91 ~SyncableService() override; |
91 }; | 92 }; |
92 | 93 |
93 } // namespace syncer | 94 } // namespace syncer |
94 | 95 |
95 #endif // SYNC_API_SYNCABLE_SERVICE_H_ | 96 #endif // SYNC_API_SYNCABLE_SERVICE_H_ |
OLD | NEW |