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

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

Issue 2849523003: Add billing address as a mandatory field of Payments credit cards. (Closed)
Patch Set: Added AddressComboboxModel unittests and fixed more compile issues. 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
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/shipping_address_editor_view_controll er.h" 5 #include "chrome/browser/ui/views/payments/shipping_address_editor_view_controll er.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 NOTREACHED(); 61 NOTREACHED();
62 return autofill::UNKNOWN_TYPE; 62 return autofill::UNKNOWN_TYPE;
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
67 ShippingAddressEditorViewController::ShippingAddressEditorViewController( 67 ShippingAddressEditorViewController::ShippingAddressEditorViewController(
68 PaymentRequestSpec* spec, 68 PaymentRequestSpec* spec,
69 PaymentRequestState* state, 69 PaymentRequestState* state,
70 PaymentRequestDialogView* dialog, 70 PaymentRequestDialogView* dialog,
71 BackNavigationType back_navigation_type,
71 base::OnceClosure on_edited, 72 base::OnceClosure on_edited,
72 base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, 73 base::OnceCallback<void(const autofill::AutofillProfile&)> on_added,
73 autofill::AutofillProfile* profile) 74 autofill::AutofillProfile* profile)
74 : EditorViewController(spec, state, dialog), 75 : EditorViewController(spec, state, dialog, back_navigation_type),
75 on_edited_(std::move(on_edited)), 76 on_edited_(std::move(on_edited)),
76 on_added_(std::move(on_added)), 77 on_added_(std::move(on_added)),
77 profile_to_edit_(profile), 78 profile_to_edit_(profile),
78 chosen_country_index_(0), 79 chosen_country_index_(0),
79 failed_to_load_region_data_(false) { 80 failed_to_load_region_data_(false) {
80 UpdateEditorFields(); 81 UpdateEditorFields();
81 } 82 }
82 83
83 ShippingAddressEditorViewController::~ShippingAddressEditorViewController() {} 84 ShippingAddressEditorViewController::~ShippingAddressEditorViewController() {}
84 85
85 std::unique_ptr<views::View> 86 std::unique_ptr<views::View>
86 ShippingAddressEditorViewController::CreateHeaderView() { 87 ShippingAddressEditorViewController::CreateHeaderView() {
87 return base::MakeUnique<views::View>(); 88 return base::MakeUnique<views::View>();
88 } 89 }
89 90
91 std::unique_ptr<views::View>
92 ShippingAddressEditorViewController::CreateCustomFieldsView() {
93 return base::MakeUnique<views::View>();
94 }
95
90 std::vector<EditorField> 96 std::vector<EditorField>
91 ShippingAddressEditorViewController::GetFieldDefinitions() { 97 ShippingAddressEditorViewController::GetFieldDefinitions() {
92 return editor_fields_; 98 return editor_fields_;
93 } 99 }
94 100
95 base::string16 ShippingAddressEditorViewController::GetInitialValueForType( 101 base::string16 ShippingAddressEditorViewController::GetInitialValueForType(
96 autofill::ServerFieldType type) { 102 autofill::ServerFieldType type) {
97 // Temporary profile has precedence over profile to edit since its existence 103 // Temporary profile has precedence over profile to edit since its existence
98 // is based on having unsaved stated to restore. 104 // is based on having unsaved stated to restore.
99 if (temporary_profile_.get()) { 105 if (temporary_profile_.get()) {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 bool is_required_valid = !field_.required; 422 bool is_required_valid = !field_.required;
417 const base::string16 displayed_message = 423 const base::string16 displayed_message =
418 is_required_valid ? base::ASCIIToUTF16("") 424 is_required_valid ? base::ASCIIToUTF16("")
419 : l10n_util::GetStringUTF16( 425 : l10n_util::GetStringUTF16(
420 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); 426 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE);
421 controller_->DisplayErrorMessageForField(field_, displayed_message); 427 controller_->DisplayErrorMessageForField(field_, displayed_message);
422 return is_required_valid; 428 return is_required_valid;
423 } 429 }
424 430
425 } // namespace payments 431 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698