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

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: And now using the right function from the right place... Created 6 years, 5 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/autofill/core/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d7ea312bc99a8293421bccf8be9dce660756c446..9a45edfc62d7b747edb84a25786622b680bfef40 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,9 @@
#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/src/region_data_constants.h"
+
+using ::i18n::addressinput::RegionDataConstants;
namespace autofill {
namespace {
@@ -566,7 +570,18 @@ void PersonalDataManager::GetProfileSuggestions(
std::vector<base::string16> multi_values;
profile->GetMultiInfo(type, app_locale_, &multi_values);
+ // Names need to be in vertically compact form - i.e. a single line. Join
+ // multi-line addresses into a single line, using a separator.
+ // The separator is locale-specific.
+ base::string16 compact_separator = base::UTF8ToUTF16(
+ RegionDataConstants::GetLanguageCompactLineSeparator(
+ profile->language_code()));
for (size_t i = 0; i < multi_values.size(); ++i) {
+ // Create vertically compact form.
+ std::vector<base::string16> lines;
+ base::SplitString(multi_values[i], '\n', &lines);
Evan Stade 2014/07/10 18:01:35 use ReplaceChars?
groby-ooo-7-16 2014/07/10 18:56:19 Done.
+ multi_values[i] = JoinString(lines, compact_separator);
+
if (!field_is_autofilled) {
// Suggest data that starts with what the user has typed.
if (!multi_values[i].empty() &&
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698