| 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/contact_info_editor_view_controller.h
" | 5 #include "chrome/browser/ui/views/payments/contact_info_editor_view_controller.h
" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/views/payments/validating_textfield.h" | 8 #include "chrome/browser/ui/views/payments/validating_textfield.h" |
| 9 #include "components/autofill/core/browser/autofill_country.h" | 9 #include "components/autofill/core/browser/autofill_country.h" |
| 10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 return base::MakeUnique<views::View>(); | 36 return base::MakeUnique<views::View>(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 std::vector<EditorField> | 39 std::vector<EditorField> |
| 40 ContactInfoEditorViewController::GetFieldDefinitions() { | 40 ContactInfoEditorViewController::GetFieldDefinitions() { |
| 41 std::vector<EditorField> fields; | 41 std::vector<EditorField> fields; |
| 42 if (spec()->request_payer_name()) { | 42 if (spec()->request_payer_name()) { |
| 43 fields.push_back(EditorField( | 43 fields.push_back(EditorField( |
| 44 autofill::NAME_FULL, | 44 autofill::NAME_FULL, |
| 45 l10n_util::GetStringUTF16(IDS_PAYMENTS_NAME_FIELD_IN_CONTACT_DETAILS), | 45 l10n_util::GetStringUTF16(IDS_PAYMENTS_NAME_FIELD_IN_CONTACT_DETAILS), |
| 46 EditorField::LengthHint::HINT_LONG, /*required=*/true)); | 46 EditorField::LengthHint::HINT_SHORT, /*required=*/true)); |
| 47 } | 47 } |
| 48 if (spec()->request_payer_phone()) { | 48 if (spec()->request_payer_phone()) { |
| 49 fields.push_back(EditorField( | 49 fields.push_back(EditorField( |
| 50 autofill::PHONE_HOME_WHOLE_NUMBER, | 50 autofill::PHONE_HOME_WHOLE_NUMBER, |
| 51 l10n_util::GetStringUTF16(IDS_PAYMENTS_PHONE_FIELD_IN_CONTACT_DETAILS), | 51 l10n_util::GetStringUTF16(IDS_PAYMENTS_PHONE_FIELD_IN_CONTACT_DETAILS), |
| 52 EditorField::LengthHint::HINT_LONG, /*required=*/true)); | 52 EditorField::LengthHint::HINT_SHORT, /*required=*/true)); |
| 53 } | 53 } |
| 54 if (spec()->request_payer_email()) { | 54 if (spec()->request_payer_email()) { |
| 55 fields.push_back(EditorField( | 55 fields.push_back(EditorField( |
| 56 autofill::EMAIL_ADDRESS, | 56 autofill::EMAIL_ADDRESS, |
| 57 l10n_util::GetStringUTF16(IDS_PAYMENTS_EMAIL_FIELD_IN_CONTACT_DETAILS), | 57 l10n_util::GetStringUTF16(IDS_PAYMENTS_EMAIL_FIELD_IN_CONTACT_DETAILS), |
| 58 EditorField::LengthHint::HINT_LONG, /*required=*/true)); | 58 EditorField::LengthHint::HINT_SHORT, /*required=*/true)); |
| 59 } | 59 } |
| 60 return fields; | 60 return fields; |
| 61 } | 61 } |
| 62 | 62 |
| 63 base::string16 ContactInfoEditorViewController::GetInitialValueForType( | 63 base::string16 ContactInfoEditorViewController::GetInitialValueForType( |
| 64 autofill::ServerFieldType type) { | 64 autofill::ServerFieldType type) { |
| 65 if (!profile_to_edit_) | 65 if (!profile_to_edit_) |
| 66 return base::string16(); | 66 return base::string16(); |
| 67 | 67 |
| 68 return profile_to_edit_->GetInfo(autofill::AutofillType(type), | 68 return profile_to_edit_->GetInfo(autofill::AutofillType(type), |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 | 196 |
| 197 bool ContactInfoEditorViewController::ContactInfoValidationDelegate:: | 197 bool ContactInfoEditorViewController::ContactInfoValidationDelegate:: |
| 198 ValidateCombobox(views::Combobox* combobox) { | 198 ValidateCombobox(views::Combobox* combobox) { |
| 199 // This UI doesn't contain any comboboxes. | 199 // This UI doesn't contain any comboboxes. |
| 200 NOTREACHED(); | 200 NOTREACHED(); |
| 201 return true; | 201 return true; |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace payments | 204 } // namespace payments |
| OLD | NEW |