Index: sync/syncable/entry_kernel.cc |
diff --git a/sync/syncable/entry_kernel.cc b/sync/syncable/entry_kernel.cc |
index c31edef7c29213b585f010ce31754e07c8592d93..45325ddfa2d12e68b62b6d793e41b53ef72edcac 100644 |
--- a/sync/syncable/entry_kernel.cc |
+++ b/sync/syncable/entry_kernel.cc |
@@ -21,6 +21,20 @@ EntryKernel::EntryKernel() : dirty_(false) { |
EntryKernel::~EntryKernel() {} |
+ModelType EntryKernel::GetModelType() const { |
+ ModelType specifics_type = GetModelTypeFromSpecifics(ref(SPECIFICS)); |
+ if (specifics_type != UNSPECIFIED) |
+ return specifics_type; |
+ if (ref(ID).IsRoot()) |
+ return TOP_LEVEL_FOLDER; |
+ // Loose check for server-created top-level folders that aren't |
+ // bound to a particular model type. |
+ if (!ref(UNIQUE_SERVER_TAG).empty() && ref(SERVER_IS_DIR)) |
+ return TOP_LEVEL_FOLDER; |
+ |
+ return UNSPECIFIED; |
+} |
+ |
ModelType EntryKernel::GetServerModelType() const { |
ModelType specifics_type = GetModelTypeFromSpecifics(ref(SERVER_SPECIFICS)); |
if (specifics_type != UNSPECIFIED) |
@@ -96,8 +110,13 @@ StringValue* IdToValue(const Id& id) { |
return id.ToValue(); |
} |
-StringValue* OrdinalToValue(const NodeOrdinal& ord) { |
- return Value::CreateStringValue(ord.ToDebugString()); |
+StringValue* UniquePositionToValue(const UniquePosition& pos) { |
+ return Value::CreateStringValue(pos.ToDebugString()); |
+} |
+ |
+StringValue* BytesToValue(const std::string& bytes) { |
+ return Value::CreateStringValue( |
+ base::HexEncode(bytes.data(), bytes.length())); |
} |
} // namespace |
@@ -153,10 +172,15 @@ DictionaryValue* EntryKernel::ToValue(Cryptographer* cryptographer) const { |
SetEncryptableProtoValues(*this, cryptographer, kernel_info, |
PROTO_FIELDS_BEGIN, PROTO_FIELDS_END - 1); |
- // Ordinal fields |
+ // UniquePosition fields |
+ SetFieldValues(*this, kernel_info, |
+ &GetUniquePositionFieldString, &UniquePositionToValue, |
+ UNIQUE_POSITION_FIELDS_BEGIN, UNIQUE_POSITION_FIELDS_END - 1); |
+ |
+ // Bytes fields |
SetFieldValues(*this, kernel_info, |
- &GetOrdinalFieldString, &OrdinalToValue, |
- ORDINAL_FIELDS_BEGIN, ORDINAL_FIELDS_END - 1); |
+ &GetBytesFieldString, &BytesToValue, |
+ BYTES_FIELDS_BEGIN, BYTES_FIELDS_END - 1); |
// Bit temps. |
SetFieldValues(*this, kernel_info, |