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

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

Issue 2895473005: [Payments] Have expiration date be on the same line in CC editor (Closed)
Patch Set: Initial 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate:: 489 bool ShippingAddressEditorViewController::ShippingAddressValidationDelegate::
490 ValidateValue(const base::string16& value) { 490 ValidateValue(const base::string16& value) {
491 if (!value.empty()) { 491 if (!value.empty()) {
492 if (field_.type == autofill::PHONE_HOME_WHOLE_NUMBER && 492 if (field_.type == autofill::PHONE_HOME_WHOLE_NUMBER &&
493 controller_->chosen_country_index_ < controller_->countries_.size() && 493 controller_->chosen_country_index_ < controller_->countries_.size() &&
494 !autofill::IsValidPhoneNumber( 494 !autofill::IsValidPhoneNumber(
495 value, controller_->countries_[controller_->chosen_country_index_] 495 value, controller_->countries_[controller_->chosen_country_index_]
496 .first)) { 496 .first)) {
497 controller_->DisplayErrorMessageForField( 497 controller_->DisplayErrorMessageForField(
498 field_, l10n_util::GetStringUTF16( 498 field_.type, l10n_util::GetStringUTF16(
499 IDS_PAYMENTS_PHONE_INVALID_VALIDATION_MESSAGE)); 499 IDS_PAYMENTS_PHONE_INVALID_VALIDATION_MESSAGE));
500 return false; 500 return false;
501 } 501 }
502 // As long as other field types are non-empty, they are valid. 502 // As long as other field types are non-empty, they are valid.
503 controller_->DisplayErrorMessageForField(field_, base::ASCIIToUTF16("")); 503 controller_->DisplayErrorMessageForField(field_.type,
504 base::ASCIIToUTF16(""));
504 return true; 505 return true;
505 } 506 }
506 bool is_required_valid = !field_.required; 507 bool is_required_valid = !field_.required;
507 const base::string16 displayed_message = 508 const base::string16 displayed_message =
508 is_required_valid ? base::ASCIIToUTF16("") 509 is_required_valid ? base::ASCIIToUTF16("")
509 : l10n_util::GetStringUTF16( 510 : l10n_util::GetStringUTF16(
510 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); 511 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE);
511 controller_->DisplayErrorMessageForField(field_, displayed_message); 512 controller_->DisplayErrorMessageForField(field_.type, displayed_message);
512 return is_required_valid; 513 return is_required_valid;
513 } 514 }
514 515
515 } // namespace payments 516 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698