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

Unified Diff: sync/internal_api/write_node.cc

Issue 1134793006: [Sync] WriteNode::SetTitle doesn't update bookmark title when it is empty string. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small change after Nicolas' feedback. Created 5 years, 7 months 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/internal_api/sync_manager_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698