OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Set |field_data|'s value to |value|. Uses |field|, |address_language_code|, | 75 // Set |field_data|'s value to |value|. Uses |field|, |address_language_code|, |
76 // and |app_locale| as hints when filling exceptional cases like phone number | 76 // and |app_locale| as hints when filling exceptional cases like phone number |
77 // values and <select> fields. Returns |true| if the field has been filled, | 77 // values and <select> fields. Returns |true| if the field has been filled, |
78 // |false| otherwise. | 78 // |false| otherwise. |
79 static bool FillFormField(const AutofillField& field, | 79 static bool FillFormField(const AutofillField& field, |
80 const base::string16& value, | 80 const base::string16& value, |
81 const std::string& address_language_code, | 81 const std::string& address_language_code, |
82 const std::string& app_locale, | 82 const std::string& app_locale, |
83 FormFieldData* field_data); | 83 FormFieldData* field_data); |
84 | 84 |
| 85 // Returns the phone number value for the given |field|. The returned value |
| 86 // might be |number|, or could possibly be a prefix or suffix of |number| |
| 87 // if that's appropriate for the field. |
| 88 static base::string16 GetPhoneNumberValue(const AutofillField& field, |
| 89 const base::string16& number, |
| 90 const FormFieldData& field_data); |
| 91 |
85 private: | 92 private: |
86 // The unique name of this field, generated by Autofill. | 93 // The unique name of this field, generated by Autofill. |
87 base::string16 unique_name_; | 94 base::string16 unique_name_; |
88 | 95 |
89 // The unique identifier for the section (e.g. billing vs. shipping address) | 96 // The unique identifier for the section (e.g. billing vs. shipping address) |
90 // that this field belongs to. | 97 // that this field belongs to. |
91 std::string section_; | 98 std::string section_; |
92 | 99 |
93 // The type of the field, as determined by the Autofill server. | 100 // The type of the field, as determined by the Autofill server. |
94 ServerFieldType server_type_; | 101 ServerFieldType server_type_; |
(...skipping 20 matching lines...) Expand all Loading... |
115 // Used to hold the position of the first digit to be copied as a substring | 122 // Used to hold the position of the first digit to be copied as a substring |
116 // from credit card number. | 123 // from credit card number. |
117 size_t credit_card_number_offset_; | 124 size_t credit_card_number_offset_; |
118 | 125 |
119 DISALLOW_COPY_AND_ASSIGN(AutofillField); | 126 DISALLOW_COPY_AND_ASSIGN(AutofillField); |
120 }; | 127 }; |
121 | 128 |
122 } // namespace autofill | 129 } // namespace autofill |
123 | 130 |
124 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ | 131 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ |
OLD | NEW |