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

Unified Diff: chrome/browser/ui/webui/options/autofill_options_handler.cc

Issue 386873002: Reland "Use upstream libaddressinput in Chrome." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix iOS compile. 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 | « chrome/browser/ui/webui/DEPS ('k') | chrome/tools/build/repack_locales.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/autofill_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
index cfe09e42e24367f0a4c153215d13eab42606158b..e1ff4c6d272ca93782e1ca9b1c21994c9b3f9b23 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
@@ -28,9 +28,10 @@
#include "content/public/browser/web_ui.h"
#include "grit/components_strings.h"
#include "grit/generated_resources.h"
-#include "grit/libaddressinput_strings.h"
-#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h"
-#include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui_component.h"
+#include "third_party/libaddressinput/messages.h"
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui.h"
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui_component.h"
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/localization.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
@@ -69,13 +70,24 @@ void GetAddressComponents(const std::string& country_code,
std::string* components_language_code) {
DCHECK(address_components);
+ i18n::addressinput::Localization localization;
+ localization.SetGetter(l10n_util::GetStringUTF8);
+ std::string not_used;
std::vector<AddressUiComponent> components =
i18n::addressinput::BuildComponents(
- country_code, ui_language_code, components_language_code);
+ country_code,
+ localization,
+ ui_language_code,
+ components_language_code == NULL ?
+ &not_used : components_language_code);
if (components.empty()) {
static const char kDefaultCountryCode[] = "US";
components = i18n::addressinput::BuildComponents(
- kDefaultCountryCode, ui_language_code, components_language_code);
+ kDefaultCountryCode,
+ localization,
+ ui_language_code,
+ components_language_code == NULL ?
+ &not_used : components_language_code);
}
DCHECK(!components.empty());
@@ -91,8 +103,7 @@ void GetAddressComponents(const std::string& country_code,
}
scoped_ptr<base::DictionaryValue> component(new base::DictionaryValue);
- component->SetString(
- "name", l10n_util::GetStringUTF16(components[i].name_id));
+ component->SetString("name", components[i].name);
switch (components[i].field) {
case i18n::addressinput::COUNTRY:
@@ -376,7 +387,7 @@ void AutofillOptionsHandler::SetAddressOverlayStrings(
localized_strings->SetString("autofillEditAddressTitle",
l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_ADDRESS_CAPTION));
localized_strings->SetString("autofillCountryLabel",
- l10n_util::GetStringUTF16(IDS_LIBADDRESSINPUT_I18N_COUNTRY_LABEL));
+ l10n_util::GetStringUTF16(IDS_LIBADDRESSINPUT_COUNTRY_OR_REGION_LABEL));
localized_strings->SetString("autofillPhoneLabel",
l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_PHONE));
localized_strings->SetString("autofillEmailLabel",
« no previous file with comments | « chrome/browser/ui/webui/DEPS ('k') | chrome/tools/build/repack_locales.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698