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

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: Rebase 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..a95146af961c0f963ccdae25d611b4516c5226c1 100644
--- a/sync/internal_api/write_node.cc
+++ b/sync/internal_api/write_node.cc
@@ -77,20 +77,24 @@ void WriteNode::SetTitle(const std::string& title) {
bool title_matches = (current_legal_title == new_legal_title);
bool encrypted_without_overwriting_name = (needs_encryption &&
entry_->GetNonUniqueName() != kEncryptedString);
-
- // 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) {
- DVLOG(2) << "Title matches, dropping change.";
- return;
- }
+ bool bookmark_title_updated = false;
Nicolas Zea 2015/05/15 20:15:17 Does it make sense to, instead of having this new
pavely 2015/05/15 21:45:28 I used title_matches first, but decided to use sep
// 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();
+ 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.
+ bookmark_title_updated = true;
+ }
+
+ // 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 &&
+ !bookmark_title_updated) {
+ DVLOG(2) << "Title matches, dropping change.";
+ return;
}
// For bookmarks, this has to happen after we set the title in the specifics,
« 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