OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 controller_->RequestedFieldsForSection(section); | 1499 controller_->RequestedFieldsForSection(section); |
1500 DetailsGroup* group = GroupForSection(section); | 1500 DetailsGroup* group = GroupForSection(section); |
1501 | 1501 |
1502 for (DetailInputs::const_iterator iter = updated_inputs.begin(); | 1502 for (DetailInputs::const_iterator iter = updated_inputs.begin(); |
1503 iter != updated_inputs.end(); ++iter) { | 1503 iter != updated_inputs.end(); ++iter) { |
1504 const DetailInput& input = *iter; | 1504 const DetailInput& input = *iter; |
1505 TextfieldMap::iterator text_mapping = group->textfields.find(&input); | 1505 TextfieldMap::iterator text_mapping = group->textfields.find(&input); |
1506 | 1506 |
1507 if (text_mapping != group->textfields.end()) { | 1507 if (text_mapping != group->textfields.end()) { |
1508 views::Textfield* textfield = text_mapping->second->textfield(); | 1508 views::Textfield* textfield = text_mapping->second->textfield(); |
| 1509 textfield->SetEnabled(input.editable); |
1509 if (textfield->text().empty() || clobber_inputs) { | 1510 if (textfield->text().empty() || clobber_inputs) { |
1510 textfield->SetText(iter->initial_value); | 1511 textfield->SetText(iter->initial_value); |
1511 textfield->SetIcon(controller_->IconForField( | 1512 textfield->SetIcon(controller_->IconForField( |
1512 input.type, textfield->text()).AsImageSkia()); | 1513 input.type, textfield->text()).AsImageSkia()); |
1513 } | 1514 } |
1514 } | 1515 } |
1515 | 1516 |
1516 ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input); | 1517 ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input); |
1517 if (combo_mapping != group->comboboxes.end()) { | 1518 if (combo_mapping != group->comboboxes.end()) { |
1518 views::Combobox* combobox = combo_mapping->second; | 1519 views::Combobox* combobox = combo_mapping->second; |
| 1520 combobox->SetEnabled(input.editable); |
1519 if (combobox->selected_index() == combobox->model()->GetDefaultIndex() || | 1521 if (combobox->selected_index() == combobox->model()->GetDefaultIndex() || |
1520 clobber_inputs) { | 1522 clobber_inputs) { |
1521 for (int i = 0; i < combobox->model()->GetItemCount(); ++i) { | 1523 for (int i = 0; i < combobox->model()->GetItemCount(); ++i) { |
1522 if (input.initial_value == combobox->model()->GetItemAt(i)) { | 1524 if (input.initial_value == combobox->model()->GetItemAt(i)) { |
1523 combobox->SetSelectedIndex(i); | 1525 combobox->SetSelectedIndex(i); |
1524 break; | 1526 break; |
1525 } | 1527 } |
1526 } | 1528 } |
1527 } | 1529 } |
1528 } | 1530 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 | 1614 |
1613 scoped_ptr<DetailInput> cvc_input; | 1615 scoped_ptr<DetailInput> cvc_input; |
1614 DetailOutputMap detail_outputs; | 1616 DetailOutputMap detail_outputs; |
1615 typedef std::map<AutofillFieldType, base::Callback<void(const string16&)> > | 1617 typedef std::map<AutofillFieldType, base::Callback<void(const string16&)> > |
1616 FieldMap; | 1618 FieldMap; |
1617 FieldMap field_map; | 1619 FieldMap field_map; |
1618 | 1620 |
1619 if (group.manual_input->visible()) { | 1621 if (group.manual_input->visible()) { |
1620 for (TextfieldMap::const_iterator iter = group.textfields.begin(); | 1622 for (TextfieldMap::const_iterator iter = group.textfields.begin(); |
1621 iter != group.textfields.end(); ++iter) { | 1623 iter != group.textfields.end(); ++iter) { |
| 1624 if (!iter->first->editable) |
| 1625 continue; |
| 1626 |
1622 detail_outputs[iter->first] = iter->second->textfield()->text(); | 1627 detail_outputs[iter->first] = iter->second->textfield()->text(); |
1623 field_map[iter->first->type] = base::Bind( | 1628 field_map[iter->first->type] = base::Bind( |
1624 &AutofillDialogViews::SetValidityForInput<DecoratedTextfield>, | 1629 &AutofillDialogViews::SetValidityForInput<DecoratedTextfield>, |
1625 base::Unretained(this), | 1630 base::Unretained(this), |
1626 iter->second); | 1631 iter->second); |
1627 } | 1632 } |
1628 for (ComboboxMap::const_iterator iter = group.comboboxes.begin(); | 1633 for (ComboboxMap::const_iterator iter = group.comboboxes.begin(); |
1629 iter != group.comboboxes.end(); ++iter) { | 1634 iter != group.comboboxes.end(); ++iter) { |
| 1635 if (!iter->first->editable) |
| 1636 continue; |
| 1637 |
1630 views::Combobox* combobox = iter->second; | 1638 views::Combobox* combobox = iter->second; |
1631 string16 item = | 1639 string16 item = |
1632 combobox->model()->GetItemAt(combobox->selected_index()); | 1640 combobox->model()->GetItemAt(combobox->selected_index()); |
1633 detail_outputs[iter->first] = item; | 1641 detail_outputs[iter->first] = item; |
1634 field_map[iter->first->type] = base::Bind( | 1642 field_map[iter->first->type] = base::Bind( |
1635 &AutofillDialogViews::SetValidityForInput<views::Combobox>, | 1643 &AutofillDialogViews::SetValidityForInput<views::Combobox>, |
1636 base::Unretained(this), | 1644 base::Unretained(this), |
1637 iter->second); | 1645 iter->second); |
1638 } | 1646 } |
1639 } else if (group.section == SECTION_CC) { | 1647 } else if (group.section == SECTION_CC) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 1826 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
1819 : section(section), | 1827 : section(section), |
1820 container(NULL), | 1828 container(NULL), |
1821 manual_input(NULL), | 1829 manual_input(NULL), |
1822 suggested_info(NULL), | 1830 suggested_info(NULL), |
1823 suggested_button(NULL) {} | 1831 suggested_button(NULL) {} |
1824 | 1832 |
1825 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 1833 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
1826 | 1834 |
1827 } // namespace autofill | 1835 } // namespace autofill |
OLD | NEW |