| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autofill/form_structure.h" | 5 #include "chrome/browser/autofill/form_structure.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 autocomplete_type == ASCIIToUTF16("address-line1")) { | 119 autocomplete_type == ASCIIToUTF16("address-line1")) { |
| 120 *autofill_type = ADDRESS_HOME_LINE1; | 120 *autofill_type = ADDRESS_HOME_LINE1; |
| 121 return true; | 121 return true; |
| 122 } | 122 } |
| 123 | 123 |
| 124 if (autocomplete_type == ASCIIToUTF16("address-line2")) { | 124 if (autocomplete_type == ASCIIToUTF16("address-line2")) { |
| 125 *autofill_type = ADDRESS_HOME_LINE2; | 125 *autofill_type = ADDRESS_HOME_LINE2; |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| 128 | 128 |
| 129 if (autocomplete_type == ASCIIToUTF16("locality")) { | 129 if (autocomplete_type == ASCIIToUTF16("locality") || |
| 130 autocomplete_type == ASCIIToUTF16("city")) { |
| 130 *autofill_type = ADDRESS_HOME_CITY; | 131 *autofill_type = ADDRESS_HOME_CITY; |
| 131 return true; | 132 return true; |
| 132 } | 133 } |
| 133 | 134 |
| 134 if (autocomplete_type == ASCIIToUTF16("administrative-area")) { | 135 if (autocomplete_type == ASCIIToUTF16("administrative-area") || |
| 136 autocomplete_type == ASCIIToUTF16("state") || |
| 137 autocomplete_type == ASCIIToUTF16("province") || |
| 138 autocomplete_type == ASCIIToUTF16("region")) { |
| 135 *autofill_type = ADDRESS_HOME_STATE; | 139 *autofill_type = ADDRESS_HOME_STATE; |
| 136 return true; | 140 return true; |
| 137 } | 141 } |
| 138 | 142 |
| 139 if (autocomplete_type == ASCIIToUTF16("postal-code")) { | 143 if (autocomplete_type == ASCIIToUTF16("postal-code")) { |
| 140 *autofill_type = ADDRESS_HOME_ZIP; | 144 *autofill_type = ADDRESS_HOME_ZIP; |
| 141 return true; | 145 return true; |
| 142 } | 146 } |
| 143 | 147 |
| 144 if (autocomplete_type == ASCIIToUTF16("country")) { | 148 if (autocomplete_type == ASCIIToUTF16("country")) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 159 if (autocomplete_type == ASCIIToUTF16("phone-full")) { | 163 if (autocomplete_type == ASCIIToUTF16("phone-full")) { |
| 160 *autofill_type = PHONE_HOME_WHOLE_NUMBER; | 164 *autofill_type = PHONE_HOME_WHOLE_NUMBER; |
| 161 return true; | 165 return true; |
| 162 } | 166 } |
| 163 | 167 |
| 164 if (autocomplete_type == ASCIIToUTF16("phone-country-code")) { | 168 if (autocomplete_type == ASCIIToUTF16("phone-country-code")) { |
| 165 *autofill_type = PHONE_HOME_COUNTRY_CODE; | 169 *autofill_type = PHONE_HOME_COUNTRY_CODE; |
| 166 return true; | 170 return true; |
| 167 } | 171 } |
| 168 | 172 |
| 169 if (autocomplete_type == ASCIIToUTF16("phone-city-code")) { | 173 if (autocomplete_type == ASCIIToUTF16("phone-national")) { |
| 174 *autofill_type = PHONE_HOME_CITY_AND_NUMBER; |
| 175 return true; |
| 176 } |
| 177 |
| 178 if (autocomplete_type == ASCIIToUTF16("phone-area-code")) { |
| 170 *autofill_type = PHONE_HOME_CITY_CODE; | 179 *autofill_type = PHONE_HOME_CITY_CODE; |
| 171 return true; | 180 return true; |
| 172 } | 181 } |
| 173 | 182 |
| 174 if (autocomplete_type == ASCIIToUTF16("phone-number")) { | 183 // TODO(isherman): We should more fully support "phone-local-prefix" and |
| 184 // "phone-local-suffix": http://crbug.com/92121 |
| 185 if (autocomplete_type == ASCIIToUTF16("phone-local") || |
| 186 autocomplete_type == ASCIIToUTF16("phone-local-prefix") || |
| 187 autocomplete_type == ASCIIToUTF16("phone-local-suffix")) { |
| 175 *autofill_type = PHONE_HOME_NUMBER; | 188 *autofill_type = PHONE_HOME_NUMBER; |
| 176 return true; | 189 return true; |
| 177 } | 190 } |
| 178 | 191 |
| 179 if (autocomplete_type == ASCIIToUTF16("fax-full")) { | 192 if (autocomplete_type == ASCIIToUTF16("fax-full")) { |
| 180 *autofill_type = PHONE_FAX_WHOLE_NUMBER; | 193 *autofill_type = PHONE_FAX_WHOLE_NUMBER; |
| 181 return true; | 194 return true; |
| 182 } | 195 } |
| 183 | 196 |
| 184 if (autocomplete_type == ASCIIToUTF16("fax-country-code")) { | 197 if (autocomplete_type == ASCIIToUTF16("fax-country-code")) { |
| 185 *autofill_type = PHONE_FAX_COUNTRY_CODE; | 198 *autofill_type = PHONE_FAX_COUNTRY_CODE; |
| 186 return true; | 199 return true; |
| 187 } | 200 } |
| 188 | 201 |
| 189 if (autocomplete_type == ASCIIToUTF16("fax-city-code")) { | 202 if (autocomplete_type == ASCIIToUTF16("fax-national")) { |
| 203 *autofill_type = PHONE_FAX_CITY_AND_NUMBER; |
| 204 return true; |
| 205 } |
| 206 |
| 207 if (autocomplete_type == ASCIIToUTF16("fax-area-code")) { |
| 190 *autofill_type = PHONE_FAX_CITY_CODE; | 208 *autofill_type = PHONE_FAX_CITY_CODE; |
| 191 return true; | 209 return true; |
| 192 } | 210 } |
| 193 | 211 |
| 194 if (autocomplete_type == ASCIIToUTF16("fax-number")) { | 212 // TODO(isherman): We should more fully support "fax-local-prefix" and |
| 213 // "fax-local-suffix": http://crbug.com/92121 |
| 214 if (autocomplete_type == ASCIIToUTF16("fax-local") || |
| 215 autocomplete_type == ASCIIToUTF16("fax-local-prefix") || |
| 216 autocomplete_type == ASCIIToUTF16("fax-local-suffix")) { |
| 195 *autofill_type = PHONE_FAX_NUMBER; | 217 *autofill_type = PHONE_FAX_NUMBER; |
| 196 return true; | 218 return true; |
| 197 } | 219 } |
| 198 | 220 |
| 199 if (autocomplete_type == ASCIIToUTF16("cc-full-name")) { | 221 if (autocomplete_type == ASCIIToUTF16("cc-full-name")) { |
| 200 *autofill_type = CREDIT_CARD_NAME; | 222 *autofill_type = CREDIT_CARD_NAME; |
| 201 return true; | 223 return true; |
| 202 } | 224 } |
| 203 | 225 |
| 204 if (autocomplete_type == ASCIIToUTF16("cc-number")) { | 226 if (autocomplete_type == ASCIIToUTF16("cc-number")) { |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 if (current_type != UNKNOWN_TYPE && already_saw_current_type) { | 928 if (current_type != UNKNOWN_TYPE && already_saw_current_type) { |
| 907 // We reached the end of a section, so start a new section. | 929 // We reached the end of a section, so start a new section. |
| 908 seen_types.clear(); | 930 seen_types.clear(); |
| 909 current_section = (*field)->unique_name(); | 931 current_section = (*field)->unique_name(); |
| 910 } | 932 } |
| 911 | 933 |
| 912 seen_types.insert(current_type); | 934 seen_types.insert(current_type); |
| 913 (*field)->set_section(current_section); | 935 (*field)->set_section(current_section); |
| 914 } | 936 } |
| 915 } | 937 } |
| OLD | NEW |