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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 ContactInfoEditorViewController::~ContactInfoEditorViewController() {} | 34 ContactInfoEditorViewController::~ContactInfoEditorViewController() {} |
35 | 35 |
36 std::vector<EditorField> | 36 std::vector<EditorField> |
37 ContactInfoEditorViewController::GetFieldDefinitions() { | 37 ContactInfoEditorViewController::GetFieldDefinitions() { |
38 std::vector<EditorField> fields; | 38 std::vector<EditorField> fields; |
39 if (spec()->request_payer_name()) { | 39 if (spec()->request_payer_name()) { |
40 fields.push_back(EditorField( | 40 fields.push_back(EditorField( |
41 autofill::NAME_FULL, | 41 autofill::NAME_FULL, |
42 l10n_util::GetStringUTF16(IDS_PAYMENTS_NAME_FIELD_IN_CONTACT_DETAILS), | 42 l10n_util::GetStringUTF16(IDS_PAYMENTS_NAME_FIELD_IN_CONTACT_DETAILS), |
43 EditorField::LengthHint::HINT_LONG, /*required=*/true)); | 43 EditorField::LengthHint::HINT_SHORT, /*required=*/true)); |
44 } | 44 } |
45 if (spec()->request_payer_phone()) { | 45 if (spec()->request_payer_phone()) { |
46 fields.push_back(EditorField( | 46 fields.push_back(EditorField( |
47 autofill::PHONE_HOME_WHOLE_NUMBER, | 47 autofill::PHONE_HOME_WHOLE_NUMBER, |
48 l10n_util::GetStringUTF16(IDS_PAYMENTS_PHONE_FIELD_IN_CONTACT_DETAILS), | 48 l10n_util::GetStringUTF16(IDS_PAYMENTS_PHONE_FIELD_IN_CONTACT_DETAILS), |
49 EditorField::LengthHint::HINT_LONG, /*required=*/true)); | 49 EditorField::LengthHint::HINT_SHORT, /*required=*/true)); |
50 } | 50 } |
51 if (spec()->request_payer_email()) { | 51 if (spec()->request_payer_email()) { |
52 fields.push_back(EditorField( | 52 fields.push_back(EditorField( |
53 autofill::EMAIL_ADDRESS, | 53 autofill::EMAIL_ADDRESS, |
54 l10n_util::GetStringUTF16(IDS_PAYMENTS_EMAIL_FIELD_IN_CONTACT_DETAILS), | 54 l10n_util::GetStringUTF16(IDS_PAYMENTS_EMAIL_FIELD_IN_CONTACT_DETAILS), |
55 EditorField::LengthHint::HINT_LONG, /*required=*/true)); | 55 EditorField::LengthHint::HINT_SHORT, /*required=*/true)); |
56 } | 56 } |
57 return fields; | 57 return fields; |
58 } | 58 } |
59 | 59 |
60 base::string16 ContactInfoEditorViewController::GetInitialValueForType( | 60 base::string16 ContactInfoEditorViewController::GetInitialValueForType( |
61 autofill::ServerFieldType type) { | 61 autofill::ServerFieldType type) { |
62 if (!profile_to_edit_) | 62 if (!profile_to_edit_) |
63 return base::string16(); | 63 return base::string16(); |
64 | 64 |
65 return profile_to_edit_->GetInfo(autofill::AutofillType(type), | 65 return profile_to_edit_->GetInfo(autofill::AutofillType(type), |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 192 } |
193 | 193 |
194 bool ContactInfoEditorViewController::ContactInfoValidationDelegate:: | 194 bool ContactInfoEditorViewController::ContactInfoValidationDelegate:: |
195 ValidateCombobox(views::Combobox* combobox) { | 195 ValidateCombobox(views::Combobox* combobox) { |
196 // This UI doesn't contain any comboboxes. | 196 // This UI doesn't contain any comboboxes. |
197 NOTREACHED(); | 197 NOTREACHED(); |
198 return true; | 198 return true; |
199 } | 199 } |
200 | 200 |
201 } // namespace payments | 201 } // namespace payments |
OLD | NEW |