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

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

Issue 401103004: Revert of Use language-specific street address line separators (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: components/autofill/core/browser/autofill_field.cc
diff --git a/components/autofill/core/browser/autofill_field.cc b/components/autofill/core/browser/autofill_field.cc
index c2a744203af2321856cbc617e84fece0c7a1c114..3fec668f3c76a5ac2fafe459bbaf27fb767da343 100644
--- a/components/autofill/core/browser/autofill_field.cc
+++ b/components/autofill/core/browser/autofill_field.cc
@@ -15,12 +15,8 @@
#include "components/autofill/core/browser/phone_number.h"
#include "components/autofill/core/browser/state_names.h"
#include "grit/components_strings.h"
-#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
-#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_formatter.h"
#include "ui/base/l10n/l10n_util.h"
-using ::i18n::addressinput::AddressData;
-using ::i18n::addressinput::GetStreetAddressLinesAsSingleLine;
using base::ASCIIToUTF16;
using base::StringToInt;
@@ -358,23 +354,18 @@
return true;
}
-// Fills |field| with the street address in |value|. Translates newlines into
+// Fills |field| with the street address in |value|. Translates newlines into
// equivalent separators when necessary, i.e. when filling a single-line field.
-// The separators depend on |address_language_code|.
void FillStreetAddress(const base::string16& value,
- const std::string& address_language_code,
FormFieldData* field) {
if (field->form_control_type == "textarea") {
field->value = value;
return;
}
- AddressData address_data;
- address_data.language_code = address_language_code;
- base::SplitString(base::UTF16ToUTF8(value), '\n', &address_data.address_line);
- std::string line;
- GetStreetAddressLinesAsSingleLine(address_data, &line);
- field->value = base::UTF8ToUTF16(line);
+ const base::string16& separator =
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_LINE_SEPARATOR);
+ base::ReplaceChars(value, base::ASCIIToUTF16("\n"), separator, &field->value);
}
std::string Hash32Bit(const std::string& str) {
@@ -471,7 +462,6 @@
// static
bool AutofillField::FillFormField(const AutofillField& field,
const base::string16& value,
- const std::string& address_language_code,
const std::string& app_locale,
FormFieldData* field_data) {
AutofillType type = field.Type();
@@ -484,7 +474,7 @@
} else if (field_data->form_control_type == "month") {
return FillMonthControl(value, field_data);
} else if (type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS) {
- FillStreetAddress(value, address_language_code, field_data);
+ FillStreetAddress(value, field_data);
return true;
}
« no previous file with comments | « components/autofill/core/browser/autofill_field.h ('k') | components/autofill/core/browser/autofill_field_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698