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

Unified Diff: components/reading_list/ios/reading_list_model_impl.cc

Issue 2690003004: [Reading List iOS] Collapse whitespace on item title. (Closed)
Patch Set: use url as title Created 3 years, 10 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 | « no previous file | components/reading_list/ios/reading_list_model_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/reading_list/ios/reading_list_model_impl.cc
diff --git a/components/reading_list/ios/reading_list_model_impl.cc b/components/reading_list/ios/reading_list_model_impl.cc
index 015bcc44970745800c8c832d13017071958f6446..d58fc1ba6fb797c8d8b73144ced97edfb61a33c5 100644
--- a/components/reading_list/ios/reading_list_model_impl.cc
+++ b/components/reading_list/ios/reading_list_model_impl.cc
@@ -313,10 +313,9 @@ const ReadingListEntry& ReadingListModelImpl::AddEntry(
DCHECK(url.SchemeIsHTTPOrHTTPS());
RemoveEntryByURL(url);
- std::string trimmedTitle(title);
- base::TrimWhitespaceASCII(trimmedTitle, base::TRIM_ALL, &trimmedTitle);
+ std::string trimmed_title = base::CollapseWhitespaceASCII(title, false);
- ReadingListEntry entry(url, trimmedTitle);
+ ReadingListEntry entry(url, trimmed_title);
for (auto& observer : observers_)
observer.ReadingListWillAddEntry(this, entry);
UpdateEntryStateCountersOnEntryInsertion(entry);
@@ -372,14 +371,15 @@ void ReadingListModelImpl::SetEntryTitle(const GURL& url,
return;
}
ReadingListEntry& entry = iterator->second;
- if (entry.Title() == title) {
+ std::string trimmed_title = base::CollapseWhitespaceASCII(title, false);
+ if (entry.Title() == trimmed_title) {
return;
}
for (ReadingListModelObserver& observer : observers_) {
observer.ReadingListWillUpdateEntry(this, url);
}
- entry.SetTitle(title);
+ entry.SetTitle(trimmed_title);
if (storage_layer_) {
storage_layer_->SaveEntry(entry);
}
« no previous file with comments | « no previous file | components/reading_list/ios/reading_list_model_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698