| 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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 GetDialogClientView()->UpdateDialogButtons(); | 625 GetDialogClientView()->UpdateDialogButtons(); |
| 626 ContentsPreferredSizeChanged(); | 626 ContentsPreferredSizeChanged(); |
| 627 } | 627 } |
| 628 | 628 |
| 629 void AutofillDialogViews::UpdateNotificationArea() { | 629 void AutofillDialogViews::UpdateNotificationArea() { |
| 630 DCHECK(notification_area_); | 630 DCHECK(notification_area_); |
| 631 notification_area_->SetNotifications(controller_->CurrentNotifications()); | 631 notification_area_->SetNotifications(controller_->CurrentNotifications()); |
| 632 ContentsPreferredSizeChanged(); | 632 ContentsPreferredSizeChanged(); |
| 633 } | 633 } |
| 634 | 634 |
| 635 void AutofillDialogViews::UpdateSection(DialogSection section) { | 635 void AutofillDialogViews::UpdateSection(DialogSection section, |
| 636 bool clear_user_input) { |
| 636 const DetailInputs& updated_inputs = | 637 const DetailInputs& updated_inputs = |
| 637 controller_->RequestedFieldsForSection(section); | 638 controller_->RequestedFieldsForSection(section); |
| 638 DetailsGroup* group = GroupForSection(section); | 639 DetailsGroup* group = GroupForSection(section); |
| 639 | 640 |
| 640 for (DetailInputs::const_iterator iter = updated_inputs.begin(); | 641 for (DetailInputs::const_iterator iter = updated_inputs.begin(); |
| 641 iter != updated_inputs.end(); ++iter) { | 642 iter != updated_inputs.end(); ++iter) { |
| 642 const DetailInput& input = *iter; | 643 const DetailInput& input = *iter; |
| 643 TextfieldMap::iterator text_mapping = group->textfields.find(&input); | 644 TextfieldMap::iterator text_mapping = group->textfields.find(&input); |
| 644 if (text_mapping != group->textfields.end()) | 645 |
| 646 // If there is already text in the input and |clear_user_input| is false, |
| 647 // then leave the input alone. |
| 648 if (text_mapping != group->textfields.end() && |
| 649 (text_mapping->second->textfield()->text().empty() || |
| 650 clear_user_input)) { |
| 645 text_mapping->second->textfield()->SetText(iter->initial_value); | 651 text_mapping->second->textfield()->SetText(iter->initial_value); |
| 652 } |
| 646 | 653 |
| 647 ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input); | 654 ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input); |
| 648 if (combo_mapping != group->comboboxes.end()) { | 655 if (combo_mapping != group->comboboxes.end()) { |
| 649 views::Combobox* combobox = combo_mapping->second; | 656 views::Combobox* combobox = combo_mapping->second; |
| 650 for (int i = 0; i < combobox->model()->GetItemCount(); ++i) { | 657 for (int i = 0; i < combobox->model()->GetItemCount(); ++i) { |
| 651 if (input.initial_value == combobox->model()->GetItemAt(i)) { | 658 if (input.initial_value == combobox->model()->GetItemAt(i)) { |
| 652 combobox->SetSelectedIndex(i); | 659 combobox->SetSelectedIndex(i); |
| 653 break; | 660 break; |
| 654 } | 661 } |
| 655 } | 662 } |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 1366 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
| 1360 : section(section), | 1367 : section(section), |
| 1361 container(NULL), | 1368 container(NULL), |
| 1362 manual_input(NULL), | 1369 manual_input(NULL), |
| 1363 suggested_info(NULL), | 1370 suggested_info(NULL), |
| 1364 suggested_button(NULL) {} | 1371 suggested_button(NULL) {} |
| 1365 | 1372 |
| 1366 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 1373 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
| 1367 | 1374 |
| 1368 } // namespace autofill | 1375 } // namespace autofill |
| OLD | NEW |