Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(856)

Side by Side Diff: chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc

Issue 2888203004: Properly update the payment request credit card billing combob box when a new address is added. (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698