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 COMPONENTS_SYNC_API_SYNC_DATA_H_ | 5 #ifndef COMPONENTS_SYNC_API_SYNC_DATA_H_ |
6 #define COMPONENTS_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> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 const std::string& non_unique_title, | 66 const std::string& non_unique_title, |
67 const sync_pb::EntitySpecifics& specifics, | 67 const sync_pb::EntitySpecifics& specifics, |
68 const AttachmentIdList& attachment_ids); | 68 const AttachmentIdList& attachment_ids); |
69 | 69 |
70 // Helper method for creating SyncData objects originating from the syncer. | 70 // Helper method for creating SyncData objects originating from the syncer. |
71 static SyncData CreateRemoteData( | 71 static SyncData CreateRemoteData( |
72 int64_t id, | 72 int64_t id, |
73 const sync_pb::EntitySpecifics& specifics, | 73 const sync_pb::EntitySpecifics& specifics, |
74 const base::Time& last_modified_time, | 74 const base::Time& last_modified_time, |
75 const AttachmentIdList& attachment_ids, | 75 const AttachmentIdList& attachment_ids, |
76 const syncer::AttachmentServiceProxy& attachment_service, | 76 const AttachmentServiceProxy& attachment_service, |
77 const std::string& client_tag_hash = std::string()); | 77 const std::string& client_tag_hash = std::string()); |
78 | 78 |
79 // Whether this SyncData holds valid data. The only way to have a SyncData | 79 // Whether this SyncData holds valid data. The only way to have a SyncData |
80 // without valid data is to use the default constructor. | 80 // without valid data is to use the default constructor. |
81 bool IsValid() const; | 81 bool IsValid() const; |
82 | 82 |
83 // Return the datatype we're holding information about. Derived from the sync | 83 // Return the datatype we're holding information about. Derived from the sync |
84 // datatype specifics. | 84 // datatype specifics. |
85 ModelType GetDataType() const; | 85 ModelType GetDataType() const; |
86 | 86 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 AttachmentServiceProxy attachment_service_; | 138 AttachmentServiceProxy attachment_service_; |
139 | 139 |
140 private: | 140 private: |
141 // Whether this SyncData holds valid data. | 141 // Whether this SyncData holds valid data. |
142 bool is_valid_; | 142 bool is_valid_; |
143 | 143 |
144 // Clears |entity| and |attachments|. | 144 // Clears |entity| and |attachments|. |
145 SyncData(int64_t id, | 145 SyncData(int64_t id, |
146 sync_pb::SyncEntity* entity, | 146 sync_pb::SyncEntity* entity, |
147 const base::Time& remote_modification_time, | 147 const base::Time& remote_modification_time, |
148 const syncer::AttachmentServiceProxy& attachment_service); | 148 const AttachmentServiceProxy& attachment_service); |
149 }; | 149 }; |
150 | 150 |
151 // A SyncData going to the syncer. | 151 // A SyncData going to the syncer. |
152 class SyncDataLocal : public SyncData { | 152 class SyncDataLocal : public SyncData { |
153 public: | 153 public: |
154 // Construct a SyncDataLocal from a SyncData. | 154 // Construct a SyncDataLocal from a SyncData. |
155 // | 155 // |
156 // |sync_data|'s IsLocal() must be true. | 156 // |sync_data|'s IsLocal() must be true. |
157 explicit SyncDataLocal(const SyncData& sync_data); | 157 explicit SyncDataLocal(const SyncData& sync_data); |
158 ~SyncDataLocal(); | 158 ~SyncDataLocal(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 }; | 196 }; |
197 | 197 |
198 // gmock printer helper. | 198 // gmock printer helper. |
199 void PrintTo(const SyncData& sync_data, std::ostream* os); | 199 void PrintTo(const SyncData& sync_data, std::ostream* os); |
200 | 200 |
201 typedef std::vector<SyncData> SyncDataList; | 201 typedef std::vector<SyncData> SyncDataList; |
202 | 202 |
203 } // namespace syncer | 203 } // namespace syncer |
204 | 204 |
205 #endif // COMPONENTS_SYNC_API_SYNC_DATA_H_ | 205 #endif // COMPONENTS_SYNC_API_SYNC_DATA_H_ |
OLD | NEW |