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

Unified 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: Components Unittests fix 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
index 19d1039e56b570569606fe7eda6a4c8d3f415f1c..4c9b88d474c6b210cb770a8469332411dd9b0ed7 100644
--- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
+++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
@@ -13,6 +13,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
+#include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
#include "chrome/browser/ui/views/payments/validating_combobox.h"
#include "chrome/browser/ui/views/payments/validating_textfield.h"
#include "chrome/grit/generated_resources.h"
@@ -68,10 +69,11 @@ ShippingAddressEditorViewController::ShippingAddressEditorViewController(
PaymentRequestSpec* spec,
PaymentRequestState* state,
PaymentRequestDialogView* dialog,
+ BackNavigationType back_navigation_type,
base::OnceClosure on_edited,
base::OnceCallback<void(const autofill::AutofillProfile&)> on_added,
autofill::AutofillProfile* profile)
- : EditorViewController(spec, state, dialog),
+ : EditorViewController(spec, state, dialog, back_navigation_type),
on_edited_(std::move(on_edited)),
on_added_(std::move(on_added)),
profile_to_edit_(profile),
@@ -87,6 +89,11 @@ ShippingAddressEditorViewController::CreateHeaderView() {
return base::MakeUnique<views::View>();
}
+std::unique_ptr<views::View>
+ShippingAddressEditorViewController::CreateCustomFieldsView() {
Mathieu 2017/05/04 20:29:19 A pattern that we sometimes use is that you could
MAD 2017/05/05 00:50:07 I was following the pattern used by other similar
Mathieu 2017/05/05 13:51:33 I have a slightly preference for what I suggested
MAD 2017/05/05 18:32:34 OK, then I'll change all the others too. Note that
+ return base::MakeUnique<views::View>();
+}
+
std::vector<EditorField>
ShippingAddressEditorViewController::GetFieldDefinitions() {
return editor_fields_;
@@ -113,7 +120,6 @@ bool ShippingAddressEditorViewController::ValidateModelAndSave() {
autofill::AutofillProfile profile;
if (!SaveFieldsToProfile(&profile, /*ignore_errors=*/false))
return false;
-
if (!profile_to_edit_) {
// Add the profile (will not add a duplicate).
profile.set_origin(autofill::kSettingsOrigin);
@@ -223,6 +229,14 @@ base::string16 ShippingAddressEditorViewController::GetSheetTitle() {
: l10n_util::GetStringUTF16(IDS_PAYMENTS_ADD_ADDRESS);
}
+std::unique_ptr<views::Button>
+ShippingAddressEditorViewController::CreatePrimaryButton() {
+ std::unique_ptr<views::Button> button(
+ EditorViewController::CreatePrimaryButton());
+ button->set_id(static_cast<int>(DialogViewID::SAVE_ADDRESS_BUTTON));
+ return button;
+}
+
void ShippingAddressEditorViewController::UpdateEditorFields() {
editor_fields_.clear();
std::string chosen_country_code;
@@ -412,7 +426,6 @@ bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
controller_->DisplayErrorMessageForField(field_, base::ASCIIToUTF16(""));
return true;
}
-
bool is_required_valid = !field_.required;
const base::string16 displayed_message =
is_required_valid ? base::ASCIIToUTF16("")

Powered by Google App Engine
This is Rietveld 408576698