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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 GetDialogClientView()->UpdateDialogButtons(); | 644 GetDialogClientView()->UpdateDialogButtons(); |
645 ContentsPreferredSizeChanged(); | 645 ContentsPreferredSizeChanged(); |
646 } | 646 } |
647 | 647 |
648 void AutofillDialogViews::UpdateNotificationArea() { | 648 void AutofillDialogViews::UpdateNotificationArea() { |
649 DCHECK(notification_area_); | 649 DCHECK(notification_area_); |
650 notification_area_->SetNotifications(controller_->CurrentNotifications()); | 650 notification_area_->SetNotifications(controller_->CurrentNotifications()); |
651 ContentsPreferredSizeChanged(); | 651 ContentsPreferredSizeChanged(); |
652 } | 652 } |
653 | 653 |
654 void AutofillDialogViews::UpdateSection(DialogSection section) { | 654 void AutofillDialogViews::UpdateSection(DialogSection section, |
| 655 UserInputAction action) { |
655 const DetailInputs& updated_inputs = | 656 const DetailInputs& updated_inputs = |
656 controller_->RequestedFieldsForSection(section); | 657 controller_->RequestedFieldsForSection(section); |
657 DetailsGroup* group = GroupForSection(section); | 658 DetailsGroup* group = GroupForSection(section); |
658 | 659 |
659 for (DetailInputs::const_iterator iter = updated_inputs.begin(); | 660 for (DetailInputs::const_iterator iter = updated_inputs.begin(); |
660 iter != updated_inputs.end(); ++iter) { | 661 iter != updated_inputs.end(); ++iter) { |
661 const DetailInput& input = *iter; | 662 const DetailInput& input = *iter; |
662 TextfieldMap::iterator text_mapping = group->textfields.find(&input); | 663 TextfieldMap::iterator text_mapping = group->textfields.find(&input); |
663 if (text_mapping != group->textfields.end()) | 664 |
| 665 if (text_mapping != group->textfields.end() && |
| 666 (text_mapping->second->textfield()->text().empty() || |
| 667 action == CLEAR_USER_INPUT)) { |
664 text_mapping->second->textfield()->SetText(iter->initial_value); | 668 text_mapping->second->textfield()->SetText(iter->initial_value); |
| 669 } |
665 | 670 |
666 ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input); | 671 ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input); |
667 if (combo_mapping != group->comboboxes.end()) { | 672 if (combo_mapping != group->comboboxes.end()) { |
668 views::Combobox* combobox = combo_mapping->second; | 673 views::Combobox* combobox = combo_mapping->second; |
669 for (int i = 0; i < combobox->model()->GetItemCount(); ++i) { | 674 for (int i = 0; i < combobox->model()->GetItemCount(); ++i) { |
670 if (input.initial_value == combobox->model()->GetItemAt(i)) { | 675 if (input.initial_value == combobox->model()->GetItemAt(i)) { |
671 combobox->SetSelectedIndex(i); | 676 combobox->SetSelectedIndex(i); |
672 break; | 677 break; |
673 } | 678 } |
674 } | 679 } |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 1396 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
1392 : section(section), | 1397 : section(section), |
1393 container(NULL), | 1398 container(NULL), |
1394 manual_input(NULL), | 1399 manual_input(NULL), |
1395 suggested_info(NULL), | 1400 suggested_info(NULL), |
1396 suggested_button(NULL) {} | 1401 suggested_button(NULL) {} |
1397 | 1402 |
1398 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 1403 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
1399 | 1404 |
1400 } // namespace autofill | 1405 } // namespace autofill |
OLD | NEW |