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 "components/sync/core/base_node.h" | 5 #include "components/sync/core/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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 | 256 |
257 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { | 257 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { |
258 return GetUnencryptedSpecifics(GetEntry()); | 258 return GetUnencryptedSpecifics(GetEntry()); |
259 } | 259 } |
260 | 260 |
261 ModelType BaseNode::GetModelType() const { | 261 ModelType BaseNode::GetModelType() const { |
262 return GetEntry()->GetModelType(); | 262 return GetEntry()->GetModelType(); |
263 } | 263 } |
264 | 264 |
265 const syncer::AttachmentIdList BaseNode::GetAttachmentIds() const { | 265 const AttachmentIdList BaseNode::GetAttachmentIds() const { |
266 AttachmentIdList result; | 266 AttachmentIdList result; |
267 const sync_pb::AttachmentMetadata& metadata = | 267 const sync_pb::AttachmentMetadata& metadata = |
268 GetEntry()->GetAttachmentMetadata(); | 268 GetEntry()->GetAttachmentMetadata(); |
269 for (int i = 0; i < metadata.record_size(); ++i) { | 269 for (int i = 0; i < metadata.record_size(); ++i) { |
270 result.push_back(AttachmentId::CreateFromProto(metadata.record(i).id())); | 270 result.push_back(AttachmentId::CreateFromProto(metadata.record(i).id())); |
271 } | 271 } |
272 return result; | 272 return result; |
273 } | 273 } |
274 | 274 |
275 void BaseNode::SetUnencryptedSpecifics( | 275 void BaseNode::SetUnencryptedSpecifics( |
276 const sync_pb::EntitySpecifics& specifics) { | 276 const sync_pb::EntitySpecifics& specifics) { |
277 ModelType type = GetModelTypeFromSpecifics(specifics); | 277 ModelType type = GetModelTypeFromSpecifics(specifics); |
278 DCHECK_NE(UNSPECIFIED, type); | 278 DCHECK_NE(UNSPECIFIED, type); |
279 if (GetModelType() != UNSPECIFIED) { | 279 if (GetModelType() != UNSPECIFIED) { |
280 DCHECK_EQ(GetModelType(), type); | 280 DCHECK_EQ(GetModelType(), type); |
281 } | 281 } |
282 unencrypted_data_.CopyFrom(specifics); | 282 unencrypted_data_.CopyFrom(specifics); |
283 } | 283 } |
284 | 284 |
285 } // namespace syncer | 285 } // namespace syncer |
OLD | NEW |