Chromium Code Reviews| 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 5d212bdf7cb4ef9c7636da6d1ed1643d92f359a4..8c8eb05083a5e61e44bd82238d6821a073f475e6 100644 |
| --- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc |
| +++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc |
| @@ -4,6 +4,7 @@ |
| #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" |
| +#include "base/string_number_conversions.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| #include "chrome/browser/ui/views/constrained_window_views.h" |
| @@ -105,6 +106,13 @@ void AutofillDialogViews::GetUserInput(DialogSection section, |
| it != group->textfields.end(); ++it) { |
| output->insert(std::make_pair(it->first, it->second->text())); |
| } |
| + for (ComboboxMap::iterator it = group->comboboxes.begin(); |
| + it != group->comboboxes.end(); ++it) { |
| + views::Combobox* combobox = it->second; |
| + output->insert(std::make_pair( |
| + it->first, |
| + combobox->model()->GetItemAt(combobox->selected_index()))); |
| + } |
| } |
| bool AutofillDialogViews::UseBillingForShipping() { |
| @@ -148,14 +156,6 @@ bool AutofillDialogViews::UseChromeStyle() const { |
| return true; |
| } |
| -ui::ModalType AutofillDialogViews::GetModalType() const { |
| -#if defined(USE_ASH) |
| - return ui::MODAL_TYPE_CHILD; |
| -#else |
| - return views::WidgetDelegate::GetModalType(); |
| -#endif |
| -} |
| - |
| bool AutofillDialogViews::Cancel() { |
| return true; |
| } |
| @@ -300,6 +300,7 @@ views::View* AutofillDialogViews::CreateInputsContainer(DialogSection section) { |
| views::View* AutofillDialogViews::InitInputsView(DialogSection section) { |
| const DetailInputs& inputs = controller_->RequestedFieldsForSection(section); |
| TextfieldMap* textfields = &GroupForSection(section)->textfields; |
| + ComboboxMap* comboboxes = &GroupForSection(section)->comboboxes; |
| views::View* view = new views::View(); |
| views::GridLayout* layout = new views::GridLayout(view); |
| @@ -335,11 +336,23 @@ views::View* AutofillDialogViews::InitInputsView(DialogSection section) { |
| 0, |
| 0); |
| - views::Textfield* field = new views::Textfield(); |
| - field->set_placeholder_text(ASCIIToUTF16(input.placeholder_text)); |
| - field->SetText(input.starting_value); |
| - textfields->insert(std::make_pair(&input, field)); |
| - layout->AddView(field); |
| + ui::ComboboxModel* input_model = |
| + controller_->ComboboxModelForAutofillType(input.type); |
| + // TODO(estade): TextFields and Comboboxes need to be the same height. |
| + if (input_model) { |
| + views::Combobox* combobox = new views::Combobox(input_model); |
| + int starting_value; |
| + if (base::StringToInt(input.starting_value, &starting_value)) |
| + combobox->SetSelectedIndex(starting_value); |
|
Ilya Sherman
2012/11/30 01:01:32
This looks like it will try to use values like "20
Evan Stade
2012/11/30 22:55:25
no, you're not.
|
| + comboboxes->insert(std::make_pair(&input, combobox)); |
| + layout->AddView(combobox); |
| + } else { |
| + views::Textfield* field = new views::Textfield(); |
| + field->set_placeholder_text(ASCIIToUTF16(input.placeholder_text)); |
| + field->SetText(input.starting_value); |
| + textfields->insert(std::make_pair(&input, field)); |
| + layout->AddView(field); |
| + } |
| } |
| return view; |