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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.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/views/autofill/autofill_dialog_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index 20bb3143390eb3c88d127689ddfd8df1463c2432..5b9b6d7711790843ebaad9631d94ad5536700bd9 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -1733,9 +1733,11 @@ void AutofillDialogViews::OnDidChangeFocus(
}
void AutofillDialogViews::OnSelectedIndexChanged(views::Combobox* combobox) {
- DetailsGroup* group = GroupForView(combobox);
- ValidateGroup(*group, VALIDATE_EDIT);
- SetEditabilityForSection(group->section);
+ DialogSection section = GroupForView(combobox)->section;
+ int index = combobox->selected_index();
+ delegate_->ComboboxItemSelected(combobox->model(), section, index);
+ ValidateGroup(*GroupForSection(section), VALIDATE_EDIT);
+ SetEditabilityForSection(section);
}
void AutofillDialogViews::StyledLabelLinkClicked(const gfx::Range& range,
@@ -1893,6 +1895,7 @@ views::View* AutofillDialogViews::CreateDetailsContainer() {
details_container_ = new DetailsContainerView(
base::Bind(&AutofillDialogViews::DetailsContainerBoundsChanged,
base::Unretained(this)));
+
// A box layout is used because it respects widget visibility.
details_container_->SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
@@ -1908,8 +1911,8 @@ views::View* AutofillDialogViews::CreateDetailsContainer() {
void AutofillDialogViews::CreateDetailsSection(DialogSection section) {
// Inputs container (manual inputs + combobox).
views::View* inputs_container = CreateInputsContainer(section);
-
DetailsGroup* group = GroupForSection(section);
+
// Container (holds label + inputs).
group->container = new SectionContainer(
delegate_->LabelForSection(section),
@@ -1944,14 +1947,17 @@ views::View* AutofillDialogViews::CreateInputsContainer(DialogSection section) {
// TODO(estade): we should be using Chrome-style constrained window padding
// values.
views::View* AutofillDialogViews::InitInputsView(DialogSection section) {
- const DetailInputs& inputs = delegate_->RequestedFieldsForSection(section);
TextfieldMap* textfields = &GroupForSection(section)->textfields;
+ textfields->clear();
+
ComboboxMap* comboboxes = &GroupForSection(section)->comboboxes;
+ comboboxes->clear();
views::View* view = new views::View();
views::GridLayout* layout = new views::GridLayout(view);
view->SetLayoutManager(layout);
+ const DetailInputs& inputs = delegate_->RequestedFieldsForSection(section);
for (DetailInputs::const_iterator it = inputs.begin();
it != inputs.end(); ++it) {
const DetailInput& input = *it;
@@ -2027,19 +2033,24 @@ void AutofillDialogViews::ShowDialogInMode(DialogMode dialog_mode) {
void AutofillDialogViews::UpdateSectionImpl(
DialogSection section,
bool clobber_inputs) {
- // Reset all validity marks for this section.
- if (clobber_inputs)
- MarkInputsInvalid(section, ValidityMessages(), true);
+ DetailsGroup* group = GroupForSection(section);
+
+ if (clobber_inputs) {
+ views::View* parent = group->manual_input->parent();
+ int add_index = parent->GetIndexOf(group->manual_input);
+ parent->RemoveChildView(group->manual_input);
+ group->manual_input = InitInputsView(section);
+ parent->AddChildViewAt(group->manual_input, add_index);
Dan Beam 2013/11/22 00:15:24 ^ there are still paint issues here, but the rest
+ }
const DetailInputs& updated_inputs =
delegate_->RequestedFieldsForSection(section);
- DetailsGroup* group = GroupForSection(section);
for (DetailInputs::const_iterator iter = updated_inputs.begin();
iter != updated_inputs.end(); ++iter) {
const DetailInput& input = *iter;
- TextfieldMap::iterator text_mapping = group->textfields.find(&input);
+ TextfieldMap::iterator text_mapping = group->textfields.find(&input);
if (text_mapping != group->textfields.end()) {
DecoratedTextfield* decorated = text_mapping->second;
if (decorated->text().empty() || clobber_inputs)
@@ -2174,7 +2185,6 @@ void AutofillDialogViews::MarkInputsInvalid(
// Purge invisible views from |validity_map_|.
std::map<views::View*, base::string16>::iterator it;
for (it = validity_map_.begin(); it != validity_map_.end();) {
- DCHECK(GroupForView(it->first));
if (GroupForView(it->first) == group)
validity_map_.erase(it++);
else

Powered by Google App Engine
This is Rietveld 408576698