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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 63053003: Ask libaddressinput for address components to use in requestAutocomplete(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 1 month 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: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index cf3c1a061e340b8c8c28b064daa89dacb5021be2..b075d1350c77b2694bd782315f69120122a14fc8 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/autofill/autofill_dialog_common.h"
+#include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h"
#include "chrome/browser/ui/autofill/autofill_dialog_view.h"
#include "chrome/browser/ui/autofill/data_model_wrapper.h"
#if !defined(OS_ANDROID)
@@ -623,14 +624,10 @@ void AutofillDialogControllerImpl::Show() {
return;
}
- common::BuildInputsForSection(SECTION_CC,
- &requested_cc_fields_);
- common::BuildInputsForSection(SECTION_BILLING,
- &requested_billing_fields_);
- common::BuildInputsForSection(SECTION_CC_BILLING,
- &requested_cc_billing_fields_);
- common::BuildInputsForSection(SECTION_SHIPPING,
- &requested_shipping_fields_);
+ std::string country_guess = i18ninput::GuessCountry();
+ for (size_t section = SECTION_MIN; section <= SECTION_MAX; ++section) {
+ BuildInputsForSection(static_cast<DialogSection>(section), country_guess);
+ }
// Test whether we need to show the shipping section. If filling that section
// would be a no-op, don't show it.
@@ -1946,6 +1943,18 @@ void AutofillDialogControllerImpl::UserEditedOrActivatedInput(
popup_ids);
}
+void AutofillDialogControllerImpl::ComboboxItemSelected(
+ ui::ComboboxModel* model,
+ DialogSection section,
+ int index) {
+ if (model == &country_combobox_model_) {
+ base::string16 country = model->GetItemAt(index);
+ std::string locale = g_browser_process->GetApplicationLocale();
+ std::string country_code = AutofillCountry::GetCountryCode(country, locale);
+ BuildInputsForSection(section, country_code);
+ }
+}
+
void AutofillDialogControllerImpl::FocusMoved() {
HidePopup();
}
@@ -2452,6 +2461,17 @@ void AutofillDialogControllerImpl::UpdateAccountChooserView() {
////////////////////////////////////////////////////////////////////////////////
+
+void AutofillDialogControllerImpl::BuildInputsForSection(
+ DialogSection section,
+ const std::string& country_code) {
+ DetailInputs* inputs = MutableRequestedFieldsForSection(section);
+ common::BuildInputsForSection(section, inputs, country_code);
+
+ if (view_)
+ view_->UpdateSection(section);
+}
+
bool AutofillDialogControllerImpl::HandleKeyPressEventInInput(
const content::NativeWebKeyboardEvent& event) {
if (popup_controller_.get())

Powered by Google App Engine
This is Rietveld 408576698