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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 | 221 |
222 int BaseNode::GetTotalNodeCount() const { | 222 int BaseNode::GetTotalNodeCount() const { |
223 return GetEntry()->GetTotalNodeCount(); | 223 return GetEntry()->GetTotalNodeCount(); |
224 } | 224 } |
225 | 225 |
226 int BaseNode::GetPositionIndex() const { | 226 int BaseNode::GetPositionIndex() const { |
227 return GetEntry()->GetPositionIndex(); | 227 return GetEntry()->GetPositionIndex(); |
228 } | 228 } |
229 | 229 |
230 DictionaryValue* BaseNode::GetSummaryAsValue() const { | 230 base::DictionaryValue* BaseNode::GetSummaryAsValue() const { |
231 DictionaryValue* node_info = new DictionaryValue(); | 231 base::DictionaryValue* node_info = new base::DictionaryValue(); |
232 node_info->SetString("id", base::Int64ToString(GetId())); | 232 node_info->SetString("id", base::Int64ToString(GetId())); |
233 node_info->SetBoolean("isFolder", GetIsFolder()); | 233 node_info->SetBoolean("isFolder", GetIsFolder()); |
234 node_info->SetString("title", GetTitle()); | 234 node_info->SetString("title", GetTitle()); |
235 node_info->Set("type", ModelTypeToValue(GetModelType())); | 235 node_info->Set("type", ModelTypeToValue(GetModelType())); |
236 return node_info; | 236 return node_info; |
237 } | 237 } |
238 | 238 |
239 DictionaryValue* BaseNode::GetDetailsAsValue() const { | 239 base::DictionaryValue* BaseNode::GetDetailsAsValue() const { |
240 DictionaryValue* node_info = GetSummaryAsValue(); | 240 base::DictionaryValue* node_info = GetSummaryAsValue(); |
241 node_info->SetString( | 241 node_info->SetString( |
242 "modificationTime", GetTimeDebugString(GetModificationTime())); | 242 "modificationTime", GetTimeDebugString(GetModificationTime())); |
243 node_info->SetString("parentId", base::Int64ToString(GetParentId())); | 243 node_info->SetString("parentId", base::Int64ToString(GetParentId())); |
244 // Specifics are already in the Entry value, so no need to duplicate | 244 // Specifics are already in the Entry value, so no need to duplicate |
245 // it here. | 245 // it here. |
246 node_info->SetString("externalId", base::Int64ToString(GetExternalId())); | 246 node_info->SetString("externalId", base::Int64ToString(GetExternalId())); |
247 if (GetEntry()->ShouldMaintainPosition() && | 247 if (GetEntry()->ShouldMaintainPosition() && |
248 !GetEntry()->Get(syncable::IS_DEL)) { | 248 !GetEntry()->Get(syncable::IS_DEL)) { |
249 node_info->SetString("successorId", base::Int64ToString(GetSuccessorId())); | 249 node_info->SetString("successorId", base::Int64ToString(GetSuccessorId())); |
250 node_info->SetString( | 250 node_info->SetString( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 const sync_pb::EntitySpecifics& specifics) { | 352 const sync_pb::EntitySpecifics& specifics) { |
353 ModelType type = GetModelTypeFromSpecifics(specifics); | 353 ModelType type = GetModelTypeFromSpecifics(specifics); |
354 DCHECK_NE(UNSPECIFIED, type); | 354 DCHECK_NE(UNSPECIFIED, type); |
355 if (GetModelType() != UNSPECIFIED) { | 355 if (GetModelType() != UNSPECIFIED) { |
356 DCHECK_EQ(GetModelType(), type); | 356 DCHECK_EQ(GetModelType(), type); |
357 } | 357 } |
358 unencrypted_data_.CopyFrom(specifics); | 358 unencrypted_data_.CopyFrom(specifics); |
359 } | 359 } |
360 | 360 |
361 } // namespace syncer | 361 } // namespace syncer |
OLD | NEW |