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

Unified Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 264053007: [rAC] Display Autofill popups vertically compact. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 6 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/autofill/core/browser/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index 1d4173e592564b7f0d24937d8cbc9d994ddbea25..25c461c31807407578d55f5d6fcbdde446935425 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -13,6 +13,7 @@
#include "base/memory/ref_counted.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/autofill-inl.h"
@@ -24,6 +25,7 @@
#include "components/autofill/core/browser/phone_number_i18n.h"
#include "components/autofill/core/browser/validation.h"
#include "components/autofill/core/common/autofill_pref_names.h"
+#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h"
namespace autofill {
namespace {
@@ -633,6 +635,17 @@ void PersonalDataManager::GetProfileSuggestions(
labels->resize(values->size());
}
+ // Names need to be in vertically compact form - i.e. a single line. Join
+ // multi-line names into a single line, using a separator.
+ // The separator is locale-specific.
+ base::string16 compact_separator = base::UTF8ToUTF16(
+ ::i18n::addressinput::GetCompactAddressLinesSeparator(app_locale_));
+ for (size_t i = 0; i < values->size(); ++i) {
+ std::vector<base::string16> lines;
+ base::SplitString((*values)[i], '\n', &lines);
+ (*values)[i] = (JoinString(lines, compact_separator));
+ }
+
// No icons for profile suggestions.
icons->resize(values->size());
}

Powered by Google App Engine
This is Rietveld 408576698