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