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

Unified Diff: ios/chrome/browser/reading_list/reading_list_download_service.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
Index: ios/chrome/browser/reading_list/reading_list_download_service.cc
diff --git a/ios/chrome/browser/reading_list/reading_list_download_service.cc b/ios/chrome/browser/reading_list/reading_list_download_service.cc
index 5c861446ead4cb78c7118993e8b806a19924d957..7b9c4f5901d12c4124b2354d5eb0ca4d56b397cc 100644
--- a/ios/chrome/browser/reading_list/reading_list_download_service.cc
+++ b/ios/chrome/browser/reading_list/reading_list_download_service.cc
@@ -12,6 +12,7 @@
#include "base/files/file_util.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
+#include "base/strings/string_util.h"
#include "components/reading_list/ios/offline_url_utils.h"
#include "components/reading_list/ios/reading_list_entry.h"
#include "components/reading_list/ios/reading_list_model.h"
@@ -239,8 +240,10 @@ void ReadingListDownloadService::OnDownloadEnd(
!distilled_path.empty()) {
reading_list_model_->SetEntryDistilledInfo(url, distilled_path,
distilled_url);
- if (!title.empty())
- reading_list_model_->SetEntryTitle(url, title);
+
+ std::string trimmed_title = base::CollapseWhitespaceASCII(title, false);
+ if (!trimmed_title.empty())
+ reading_list_model_->SetEntryTitle(url, trimmed_title);
const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url);
if (entry)

Powered by Google App Engine
This is Rietveld 408576698