Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: sync/syncable/entry_kernel.cc

Issue 11636006: WIP: The Bookmark Position Megapatch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Various updates, including switch suffix to unique_client_tag style Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/syncable/entry_kernel.h ('k') | sync/syncable/mutable_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « sync/syncable/entry_kernel.h ('k') | sync/syncable/mutable_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698