OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "sync/api/sync_data.h" | 5 #include "sync/api/sync_data.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 entity.mutable_specifics()->CopyFrom(specifics); | 136 entity.mutable_specifics()->CopyFrom(specifics); |
137 std::transform(attachment_ids.begin(), | 137 std::transform(attachment_ids.begin(), |
138 attachment_ids.end(), | 138 attachment_ids.end(), |
139 RepeatedFieldBackInserter(entity.mutable_attachment_id()), | 139 RepeatedFieldBackInserter(entity.mutable_attachment_id()), |
140 IdToProto); | 140 IdToProto); |
141 AttachmentList attachments; | 141 AttachmentList attachments; |
142 return SyncData( | 142 return SyncData( |
143 id, &entity, &attachments, modification_time, attachment_service); | 143 id, &entity, &attachments, modification_time, attachment_service); |
144 } | 144 } |
145 | 145 |
146 // Static. | |
147 SyncData SyncData::CreateRemoteData(int64 id, | |
148 const sync_pb::EntitySpecifics& specifics, | |
149 const base::Time& modification_time) { | |
150 return CreateRemoteData(id, | |
151 specifics, | |
152 modification_time, | |
153 AttachmentIdList(), | |
154 AttachmentServiceProxy()); | |
155 } | |
156 | |
157 bool SyncData::IsValid() const { return is_valid_; } | 146 bool SyncData::IsValid() const { return is_valid_; } |
158 | 147 |
159 const sync_pb::EntitySpecifics& SyncData::GetSpecifics() const { | 148 const sync_pb::EntitySpecifics& SyncData::GetSpecifics() const { |
160 return immutable_entity_.Get().specifics(); | 149 return immutable_entity_.Get().specifics(); |
161 } | 150 } |
162 | 151 |
163 ModelType SyncData::GetDataType() const { | 152 ModelType SyncData::GetDataType() const { |
164 return GetModelTypeFromSpecifics(GetSpecifics()); | 153 return GetModelTypeFromSpecifics(GetSpecifics()); |
165 } | 154 } |
166 | 155 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 attachment_service_.GetOrDownloadAttachments(attachment_ids, callback); | 234 attachment_service_.GetOrDownloadAttachments(attachment_ids, callback); |
246 } | 235 } |
247 | 236 |
248 void SyncDataRemote::DropAttachments( | 237 void SyncDataRemote::DropAttachments( |
249 const AttachmentIdList& attachment_ids, | 238 const AttachmentIdList& attachment_ids, |
250 const AttachmentService::DropCallback& callback) { | 239 const AttachmentService::DropCallback& callback) { |
251 attachment_service_.DropAttachments(attachment_ids, callback); | 240 attachment_service_.DropAttachments(attachment_ids, callback); |
252 } | 241 } |
253 | 242 |
254 } // namespace syncer | 243 } // namespace syncer |
OLD | NEW |