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 a1c94197e229f9989f9f6498e3fc7695a12d0deb..27796a02efe6b196235feb3557eea6ada9a04b96 100644 |
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc |
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc |
@@ -93,6 +93,22 @@ void AutofillDialogViews::Show() { |
// Ownership of |contents_| is handed off by this call. The ConstrainedWindow |
// will take care of deleting itself after calling DeleteDelegate(). |
window_ = new ConstrainedWindowViews(controller_->web_contents(), this); |
+ window_->GetFocusManager()->AddFocusChangeListener(this); |
Ilya Sherman
2012/12/20 21:57:42
This diff is not part of this CL.
Evan Stade
2012/12/20 23:04:00
please ignore the parts that are part of my previo
|
+} |
+ |
+void AutofillDialogViews::UpdateSection(DialogSection section) { |
+ const DetailInputs& updated_inputs = |
+ controller_->RequestedFieldsForSection(section); |
+ DetailsGroup* group = GroupForSection(section); |
+ |
+ for (DetailInputs::const_iterator iter = updated_inputs.begin(); |
+ iter != updated_inputs.end(); ++iter) { |
+ TextfieldMap::iterator input = group->textfields.find(&(*iter)); |
+ if (input == group->textfields.end()) |
+ continue; |
+ |
+ input->second->SetText(iter->autofilled_value); |
+ } |
} |
int AutofillDialogViews::GetSuggestionSelection(DialogSection section) { |
@@ -123,6 +139,10 @@ string16 AutofillDialogViews::GetWindowTitle() const { |
return controller_->DialogTitle(); |
} |
+void AutofillDialogViews::WindowClosing() { |
+ window_->GetFocusManager()->RemoveFocusChangeListener(this); |
+} |
+ |
void AutofillDialogViews::DeleteDelegate() { |
window_ = NULL; |
// |this| belongs to |controller_|. |
@@ -179,6 +199,38 @@ void AutofillDialogViews::OnSelectedIndexChanged(views::Combobox* combobox) { |
GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); |
} |
+void AutofillDialogViews::ContentsChanged(views::Textfield* sender, |
+ const string16& new_contents) { |
+ // TODO(estade): work for not billing. |
+ for (TextfieldMap::iterator iter = billing_.textfields.begin(); |
+ iter != billing_.textfields.end(); |
+ ++iter) { |
+ if (iter->second == sender) { |
+ controller_->UserEditedInput(iter->first, |
+ GetWidget()->GetNativeView(), |
+ sender->GetBoundsInScreen(), |
+ new_contents); |
+ break; |
+ } |
+ } |
+} |
+ |
+bool AutofillDialogViews::HandleKeyEvent(views::Textfield* sender, |
+ const ui::KeyEvent& key_event) { |
+ // TODO(estade): implement. |
+ return false; |
+} |
+ |
+void AutofillDialogViews::OnWillChangeFocus( |
+ views::View* focused_before, |
+ views::View* focused_now) { |
+ controller_->FocusMoved(); |
+} |
+ |
+void AutofillDialogViews::OnDidChangeFocus( |
+ views::View* focused_before, |
+ views::View* focused_now) {} |
+ |
void AutofillDialogViews::InitChildViews() { |
contents_ = new views::View(); |
views::GridLayout* layout = new views::GridLayout(contents_); |
@@ -372,7 +424,7 @@ views::View* AutofillDialogViews::InitInputsView(DialogSection section) { |
layout->AddView(combobox); |
for (int i = 0; i < input_model->GetItemCount(); ++i) { |
- if (input.starting_value == input_model->GetItemAt(i)) { |
+ if (input.autofilled_value == input_model->GetItemAt(i)) { |
combobox->SetSelectedIndex(i); |
break; |
} |
@@ -380,7 +432,8 @@ views::View* AutofillDialogViews::InitInputsView(DialogSection section) { |
} else { |
views::Textfield* field = new views::Textfield(); |
field->set_placeholder_text(ASCIIToUTF16(input.placeholder_text)); |
- field->SetText(input.starting_value); |
+ field->SetText(input.autofilled_value); |
+ field->SetController(this); |
textfields->insert(std::make_pair(&input, field)); |
layout->AddView(field); |
} |