Index: sync/internal_api/write_node.cc |
diff --git a/sync/internal_api/write_node.cc b/sync/internal_api/write_node.cc |
index cc445e42ff5ae74bd4790e7f9f926dca017c90da..cefe8547e12108a4200fd466a59312798bf5496a 100644 |
--- a/sync/internal_api/write_node.cc |
+++ b/sync/internal_api/write_node.cc |
@@ -78,6 +78,16 @@ void WriteNode::SetTitle(const std::string& title) { |
bool encrypted_without_overwriting_name = (needs_encryption && |
entry_->GetNonUniqueName() != kEncryptedString); |
+ // For bookmarks, we also set the title field in the specifics. |
+ // TODO(zea): refactor bookmarks to not need this functionality. |
+ sync_pb::EntitySpecifics specifics = GetEntitySpecifics(); |
+ if (GetModelType() == BOOKMARKS && |
+ specifics.bookmark().title() != new_legal_title) { |
+ specifics.mutable_bookmark()->set_title(new_legal_title); |
+ SetEntitySpecifics(specifics); // Does it's own encryption checking. |
+ title_matches = false; |
+ } |
+ |
// If the title matches and the NON_UNIQUE_NAME is properly overwritten as |
// necessary, nothing needs to change. |
if (title_matches && !encrypted_without_overwriting_name) { |
@@ -85,14 +95,6 @@ void WriteNode::SetTitle(const std::string& title) { |
return; |
} |
- // For bookmarks, we also set the title field in the specifics. |
- // TODO(zea): refactor bookmarks to not need this functionality. |
- if (GetModelType() == BOOKMARKS) { |
- sync_pb::EntitySpecifics specifics = GetEntitySpecifics(); |
- specifics.mutable_bookmark()->set_title(new_legal_title); |
- SetEntitySpecifics(specifics); // Does it's own encryption checking. |
- } |
- |
// For bookmarks, this has to happen after we set the title in the specifics, |
// because the presence of a title in the NON_UNIQUE_NAME is what controls |
// the logic deciding whether this is an empty node or a legacy bookmark. |