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_SYNC_DATA_H_ | 5 #ifndef COMPONENTS_SYNC_API_SYNC_DATA_H_ |
6 #define SYNC_API_SYNC_DATA_H_ | 6 #define COMPONENTS_SYNC_API_SYNC_DATA_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <iosfwd> | 10 #include <iosfwd> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "sync/api/attachments/attachment_id.h" | 18 #include "components/sync/api/attachments/attachment_id.h" |
19 #include "sync/base/sync_export.h" | 19 #include "components/sync/base/immutable.h" |
20 #include "sync/internal_api/public/attachments/attachment_service_proxy.h" | 20 #include "components/sync/base/model_type.h" |
21 #include "sync/internal_api/public/base/model_type.h" | 21 #include "components/sync/base/sync_export.h" |
22 #include "sync/internal_api/public/util/immutable.h" | 22 #include "components/sync/base/weak_handle.h" |
23 #include "sync/internal_api/public/util/weak_handle.h" | 23 #include "components/sync/core/attachments/attachment_service_proxy.h" |
24 | 24 |
25 namespace sync_pb { | 25 namespace sync_pb { |
26 class EntitySpecifics; | 26 class EntitySpecifics; |
27 class SyncEntity; | 27 class SyncEntity; |
28 } // namespace sync_pb | 28 } // namespace sync_pb |
29 | 29 |
30 namespace syncer { | 30 namespace syncer { |
31 | 31 |
32 class AttachmentService; | 32 class AttachmentService; |
33 class SyncDataLocal; | 33 class SyncDataLocal; |
(...skipping 17 matching lines...) Expand all Loading... |
51 // | 51 // |
52 // For deletes: |datatype| must specify the datatype who node is being | 52 // For deletes: |datatype| must specify the datatype who node is being |
53 // deleted. | 53 // deleted. |
54 // | 54 // |
55 // For adds/updates: |specifics| must be valid and |non_unique_title| (can be | 55 // For adds/updates: |specifics| must be valid and |non_unique_title| (can be |
56 // the same as |sync_tag|) must be specfied. Note: |non_unique_title| is | 56 // the same as |sync_tag|) must be specfied. Note: |non_unique_title| is |
57 // primarily for debug purposes, and will be overwritten if the datatype is | 57 // primarily for debug purposes, and will be overwritten if the datatype is |
58 // encrypted. | 58 // encrypted. |
59 // | 59 // |
60 // For data with attachments: |attachment_ids| must not contain duplicates. | 60 // For data with attachments: |attachment_ids| must not contain duplicates. |
61 static SyncData CreateLocalDelete( | 61 static SyncData CreateLocalDelete(const std::string& sync_tag, |
62 const std::string& sync_tag, | 62 ModelType datatype); |
63 ModelType datatype); | 63 static SyncData CreateLocalData(const std::string& sync_tag, |
64 static SyncData CreateLocalData( | 64 const std::string& non_unique_title, |
65 const std::string& sync_tag, | 65 const sync_pb::EntitySpecifics& specifics); |
66 const std::string& non_unique_title, | |
67 const sync_pb::EntitySpecifics& specifics); | |
68 static SyncData CreateLocalDataWithAttachments( | 66 static SyncData CreateLocalDataWithAttachments( |
69 const std::string& sync_tag, | 67 const std::string& sync_tag, |
70 const std::string& non_unique_title, | 68 const std::string& non_unique_title, |
71 const sync_pb::EntitySpecifics& specifics, | 69 const sync_pb::EntitySpecifics& specifics, |
72 const AttachmentIdList& attachment_ids); | 70 const AttachmentIdList& attachment_ids); |
73 | 71 |
74 // Helper method for creating SyncData objects originating from the syncer. | 72 // Helper method for creating SyncData objects originating from the syncer. |
75 static SyncData CreateRemoteData( | 73 static SyncData CreateRemoteData( |
76 int64_t id, | 74 int64_t id, |
77 const sync_pb::EntitySpecifics& specifics, | 75 const sync_pb::EntitySpecifics& specifics, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 const AttachmentService::GetOrDownloadCallback& callback); | 197 const AttachmentService::GetOrDownloadCallback& callback); |
200 }; | 198 }; |
201 | 199 |
202 // gmock printer helper. | 200 // gmock printer helper. |
203 void SYNC_EXPORT PrintTo(const SyncData& sync_data, std::ostream* os); | 201 void SYNC_EXPORT PrintTo(const SyncData& sync_data, std::ostream* os); |
204 | 202 |
205 typedef std::vector<SyncData> SyncDataList; | 203 typedef std::vector<SyncData> SyncDataList; |
206 | 204 |
207 } // namespace syncer | 205 } // namespace syncer |
208 | 206 |
209 #endif // SYNC_API_SYNC_DATA_H_ | 207 #endif // COMPONENTS_SYNC_API_SYNC_DATA_H_ |
OLD | NEW |