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 for use by sync when uploading or downloading | 69 // Returns AttachmentStore used by datatype. Attachment store is used by sync |
70 // attachments. | 70 // when uploading or downloading 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 // attachments should create attachment store, implement GetAttachmentStore | 75 // attachemnts should create attachment store and implement GetAttachmentStore |
76 // to return result of AttachmentStore::CreateAttachmentStoreForSync() from | 76 // to return pointer to it. |
77 // attachment store object. | 77 virtual scoped_refptr<AttachmentStore> GetAttachmentStore(); |
78 virtual scoped_ptr<AttachmentStore> GetAttachmentStoreForSync(); | |
79 | 78 |
80 // Called by sync to provide AttachmentService to be used to download | 79 // Called by sync to provide AttachmentService to be used to download |
81 // attachments. | 80 // attachments. |
82 // SetAttachmentService is called after GetAttachmentStore and right before | 81 // SetAttachmentService is called after GetAttachmentStore and right before |
83 // MergeDataAndStartSyncing and only if GetAttachmentStore has returned a | 82 // MergeDataAndStartSyncing and only if GetAttachmentStore has returned a |
84 // non-NULL store instance. Default implementation does nothing. | 83 // non-NULL store instance. Default implementation does nothing. |
85 // Datatype that uses attachments must take ownerhip of the provided | 84 // Datatype that uses attachments must take ownerhip of the provided |
86 // AttachmentService instance. | 85 // AttachmentService instance. |
87 virtual void SetAttachmentService( | 86 virtual void SetAttachmentService( |
88 scoped_ptr<AttachmentService> attachment_service); | 87 scoped_ptr<AttachmentService> attachment_service); |
89 | 88 |
90 protected: | 89 protected: |
91 ~SyncableService() override; | 90 ~SyncableService() override; |
92 }; | 91 }; |
93 | 92 |
94 } // namespace syncer | 93 } // namespace syncer |
95 | 94 |
96 #endif // SYNC_API_SYNCABLE_SERVICE_H_ | 95 #endif // SYNC_API_SYNCABLE_SERVICE_H_ |
OLD | NEW |