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

Unified Diff: components/search_engines/template_url_data.cc

Issue 1135163002: Omnibox - Strip Extra Whitespace from Custom Search Engine Names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: components/search_engines/template_url_data.cc
diff --git a/components/search_engines/template_url_data.cc b/components/search_engines/template_url_data.cc
index fdbec7d7c00b05258e5274cf31096650d966d2d4..8013697e1286b288477d500ac6cc0a2ae07da5fe 100644
--- a/components/search_engines/template_url_data.cc
+++ b/components/search_engines/template_url_data.cc
@@ -7,6 +7,7 @@
#include "base/guid.h"
#include "base/i18n/case_conversion.h"
#include "base/logging.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
TemplateURLData::TemplateURLData()
@@ -26,6 +27,14 @@ TemplateURLData::TemplateURLData()
TemplateURLData::~TemplateURLData() {
}
+void TemplateURLData::SetShortName(const base::string16& short_name) {
+ DCHECK(!short_name.empty());
+
+ // Remove tabs, carriage returns, and the like, as they can corrupt
+ // how the short name is displayed.
+ short_name_ = base::CollapseWhitespace(short_name, true);
+}
+
void TemplateURLData::SetKeyword(const base::string16& keyword) {
DCHECK(!keyword.empty());

Powered by Google App Engine
This is Rietveld 408576698