OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/payments/credit_card_editor_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 void CreditCardEditorViewController::AddAndSelectNewBillingAddress( | 368 void CreditCardEditorViewController::AddAndSelectNewBillingAddress( |
369 const autofill::AutofillProfile& profile) { | 369 const autofill::AutofillProfile& profile) { |
370 views::Combobox* address_combobox = | 370 views::Combobox* address_combobox = |
371 static_cast<views::Combobox*>(dialog()->GetViewByID(kBillingAddressType)); | 371 static_cast<views::Combobox*>(dialog()->GetViewByID(kBillingAddressType)); |
372 autofill::AddressComboboxModel* model = | 372 autofill::AddressComboboxModel* model = |
373 static_cast<autofill::AddressComboboxModel*>(address_combobox->model()); | 373 static_cast<autofill::AddressComboboxModel*>(address_combobox->model()); |
374 int index = model->AddNewProfile(profile); | 374 int index = model->AddNewProfile(profile); |
375 address_combobox->SetSelectedIndex(index); | 375 // SetSelectedIndex doesn't trigger a perform action notification, which is |
376 // Force revalidation. | 376 // needed to update the valid state. |
377 address_combobox->OnBlur(); | 377 address_combobox->SetSelectedRow(index); |
378 } | 378 } |
379 | 379 |
380 CreditCardEditorViewController::CreditCardValidationDelegate:: | 380 CreditCardEditorViewController::CreditCardValidationDelegate:: |
381 CreditCardValidationDelegate( | 381 CreditCardValidationDelegate( |
382 const EditorField& field, | 382 const EditorField& field, |
383 EditorViewController* controller, | 383 EditorViewController* controller, |
384 const std::vector<std::string>& supported_card_networks) | 384 const std::vector<std::string>& supported_card_networks) |
385 : field_(field), | 385 : field_(field), |
386 controller_(controller), | 386 controller_(controller), |
387 supported_card_networks_(supported_card_networks.begin(), | 387 supported_card_networks_(supported_card_networks.begin(), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 controller_->DisplayErrorMessageForField(field_, displayed_message); | 429 controller_->DisplayErrorMessageForField(field_, displayed_message); |
430 return is_required_valid; | 430 return is_required_valid; |
431 } | 431 } |
432 | 432 |
433 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) { | 433 bool CreditCardEditorViewController::GetSheetId(DialogViewID* sheet_id) { |
434 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET; | 434 *sheet_id = DialogViewID::CREDIT_CARD_EDITOR_SHEET; |
435 return true; | 435 return true; |
436 } | 436 } |
437 | 437 |
438 } // namespace payments | 438 } // namespace payments |
OLD | NEW |