OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MODEL_TYPE_SERVICE_H_ | 5 #ifndef SYNC_API_MODEL_TYPE_SERVICE_H_ |
6 #define SYNC_API_MODEL_TYPE_SERVICE_H_ | 6 #define SYNC_API_MODEL_TYPE_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "sync/api/entity_change.h" | |
13 #include "sync/api/entity_data.h" | 14 #include "sync/api/entity_data.h" |
14 #include "sync/api/model_type_change_processor.h" | 15 #include "sync/api/model_type_change_processor.h" |
15 #include "sync/base/sync_export.h" | 16 #include "sync/base/sync_export.h" |
16 | 17 |
17 namespace syncer { | 18 namespace syncer { |
18 class SyncError; | 19 class SyncError; |
19 } // namespace syncer | 20 } // namespace syncer |
20 | 21 |
21 namespace syncer_v2 { | 22 namespace syncer_v2 { |
22 | 23 |
(...skipping 19 matching lines...) Expand all Loading... | |
42 // Creates an object used to communicate changes in the sync metadata to the | 43 // Creates an object used to communicate changes in the sync metadata to the |
43 // model type store. | 44 // model type store. |
44 virtual MetadataChanges* CreateMetadataChanges() = 0; | 45 virtual MetadataChanges* CreateMetadataChanges() = 0; |
45 | 46 |
46 // Perform the initial merge of data from the sync server. Should only need | 47 // Perform the initial merge of data from the sync server. Should only need |
47 // to be called when sync is first turned on, not on every restart. | 48 // to be called when sync is first turned on, not on every restart. |
48 virtual syncer::SyncError MergeSyncData(MetadataChanges* metadata_changes, | 49 virtual syncer::SyncError MergeSyncData(MetadataChanges* metadata_changes, |
49 EntityDataList entity_data_list) = 0; | 50 EntityDataList entity_data_list) = 0; |
50 | 51 |
51 // Apply changes from the sync server locally. | 52 // Apply changes from the sync server locally. |
52 // TODO(skym): The change type should be in here somehow. | 53 // TODO(skym): The change type should be in here somehow. |
skym
2015/11/23 16:57:16
This TODO can be removed.
maxbogue
2015/11/23 17:00:46
Done.
| |
53 virtual syncer::SyncError ApplySyncChanges( | 54 virtual syncer::SyncError ApplySyncChanges( |
54 MetadataChanges* metadata_changes, | 55 MetadataChanges* metadata_changes, |
55 EntityDataList entity_data_list) = 0; | 56 EntityChangeList entity_changes) = 0; |
56 | 57 |
57 // Asynchronously retrieve the sync metadata. | 58 // Asynchronously retrieve the sync metadata. |
58 virtual void LoadMetadata(MetadataCallback callback) = 0; | 59 virtual void LoadMetadata(MetadataCallback callback) = 0; |
59 | 60 |
60 // Asynchronously retrieve the corresponding sync data for |client_keys|. | 61 // Asynchronously retrieve the corresponding sync data for |client_keys|. |
61 virtual void GetData(ClientKeyList client_keys, DataCallback callback) = 0; | 62 virtual void GetData(ClientKeyList client_keys, DataCallback callback) = 0; |
62 | 63 |
63 // Asynchronously retrieve all of the local sync data. | 64 // Asynchronously retrieve all of the local sync data. |
64 virtual void GetAllData(DataCallback callback) = 0; | 65 virtual void GetAllData(DataCallback callback) = 0; |
65 | 66 |
66 // Get or generate a client tag for |entity_data|. | 67 // Get or generate a client tag for |entity_data|. |
67 virtual std::string GetClientTag(const EntityData* entity_data) = 0; | 68 virtual std::string GetClientTag(const EntityData* entity_data) = 0; |
68 | 69 |
69 // TODO(skym): See crbug/547087, do we need all these accessors? | 70 // TODO(skym): See crbug/547087, do we need all these accessors? |
70 syncer_v2::ModelTypeChangeProcessor* change_processor(); | 71 syncer_v2::ModelTypeChangeProcessor* change_processor(); |
71 | 72 |
72 void set_change_processor( | 73 void set_change_processor( |
73 scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor); | 74 scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor); |
74 | 75 |
75 void clear_change_processor(); | 76 void clear_change_processor(); |
76 | 77 |
77 private: | 78 private: |
78 // Recieves ownership in set_change_processor(...). | 79 // Recieves ownership in set_change_processor(...). |
79 scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor_; | 80 scoped_ptr<syncer_v2::ModelTypeChangeProcessor> change_processor_; |
80 }; | 81 }; |
81 | 82 |
82 } // namespace syncer_v2 | 83 } // namespace syncer_v2 |
83 | 84 |
84 #endif // SYNC_API_MODEL_TYPE_SERVICE_H_ | 85 #endif // SYNC_API_MODEL_TYPE_SERVICE_H_ |
OLD | NEW |