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/internal_api/public/base_node.h" | 5 #include "sync/internal_api/public/base_node.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { | 285 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { |
286 return GetUnencryptedSpecifics(GetEntry()); | 286 return GetUnencryptedSpecifics(GetEntry()); |
287 } | 287 } |
288 | 288 |
289 ModelType BaseNode::GetModelType() const { | 289 ModelType BaseNode::GetModelType() const { |
290 return GetEntry()->GetModelType(); | 290 return GetEntry()->GetModelType(); |
291 } | 291 } |
292 | 292 |
293 const syncer::AttachmentIdList BaseNode::GetAttachmentIds() const { | 293 const syncer::AttachmentIdList BaseNode::GetAttachmentIds() const { |
294 // TODO(maniscalco): Once EntryKernel is capable of storing AttachmentIds, | 294 AttachmentIdList result; |
295 // update this method to retrieve the list of AttachmentIds from read_node and | 295 const sync_pb::AttachmentMetadata& metadata = |
296 // pass it to CreateRemoteData (bug 348625). | 296 GetEntry()->GetAttachmentMetadata(); |
297 return AttachmentIdList(); | 297 for (int i = 0; i < metadata.record_size(); ++i) { |
| 298 result.push_back(AttachmentId::CreateFromProto(metadata.record(i).id())); |
| 299 } |
| 300 return result; |
298 } | 301 } |
299 | 302 |
300 void BaseNode::SetUnencryptedSpecifics( | 303 void BaseNode::SetUnencryptedSpecifics( |
301 const sync_pb::EntitySpecifics& specifics) { | 304 const sync_pb::EntitySpecifics& specifics) { |
302 ModelType type = GetModelTypeFromSpecifics(specifics); | 305 ModelType type = GetModelTypeFromSpecifics(specifics); |
303 DCHECK_NE(UNSPECIFIED, type); | 306 DCHECK_NE(UNSPECIFIED, type); |
304 if (GetModelType() != UNSPECIFIED) { | 307 if (GetModelType() != UNSPECIFIED) { |
305 DCHECK_EQ(GetModelType(), type); | 308 DCHECK_EQ(GetModelType(), type); |
306 } | 309 } |
307 unencrypted_data_.CopyFrom(specifics); | 310 unencrypted_data_.CopyFrom(specifics); |
308 } | 311 } |
309 | 312 |
310 } // namespace syncer | 313 } // namespace syncer |
OLD | NEW |