| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 for use by sync when uploading or downloading |
| 70 // attachments. | 70 // attachments. |
| 71 // GetAttachmentStore is called right before MergeDataAndStartSyncing. If at | 71 // GetAttachmentStoreForSync is called right before MergeDataAndStartSyncing. |
| 72 // that time GetAttachmentStore returns NULL then datatype is considered not | 72 // If at that time GetAttachmentStoreForSync returns NULL then datatype is |
| 73 // using attachments and all attempts to upload/download attachments will | 73 // considered not using attachments and all attempts to upload/download |
| 74 // fail. Default implementation returns NULL. Datatype that uses sync | 74 // attachments will fail. Default implementation returns NULL. Datatype that |
| 75 // attachments should create attachment store, implement GetAttachmentStore | 75 // uses sync attachments should create attachment store, implement |
| 76 // to return result of AttachmentStore::CreateAttachmentStoreForSync() from | 76 // GetAttachmentStoreForSync to return result of |
| 77 // attachment store object. | 77 // AttachmentStore::CreateAttachmentStoreForSync() from attachment store |
| 78 virtual scoped_ptr<AttachmentStore> GetAttachmentStoreForSync(); | 78 // object. |
| 79 virtual scoped_ptr<AttachmentStoreForSync> GetAttachmentStoreForSync(); |
| 79 | 80 |
| 80 // Called by sync to provide AttachmentService to be used to download | 81 // Called by sync to provide AttachmentService to be used to download |
| 81 // attachments. | 82 // attachments. |
| 82 // SetAttachmentService is called after GetAttachmentStore and right before | 83 // SetAttachmentService is called after GetAttachmentStore and right before |
| 83 // MergeDataAndStartSyncing and only if GetAttachmentStore has returned a | 84 // MergeDataAndStartSyncing and only if GetAttachmentStore has returned a |
| 84 // non-NULL store instance. Default implementation does nothing. | 85 // non-NULL store instance. Default implementation does nothing. |
| 85 // Datatype that uses attachments must take ownerhip of the provided | 86 // Datatype that uses attachments must take ownerhip of the provided |
| 86 // AttachmentService instance. | 87 // AttachmentService instance. |
| 87 virtual void SetAttachmentService( | 88 virtual void SetAttachmentService( |
| 88 scoped_ptr<AttachmentService> attachment_service); | 89 scoped_ptr<AttachmentService> attachment_service); |
| 89 | 90 |
| 90 protected: | 91 protected: |
| 91 ~SyncableService() override; | 92 ~SyncableService() override; |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace syncer | 95 } // namespace syncer |
| 95 | 96 |
| 96 #endif // SYNC_API_SYNCABLE_SERVICE_H_ | 97 #endif // SYNC_API_SYNCABLE_SERVICE_H_ |
| OLD | NEW |