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

Side by Side Diff: components/autofill/core/browser/phone_field.cc

Issue 1774153002: [Autofill] Add the phone extension type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and adapt heuristic output Created 4 years, 9 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 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 #include "components/autofill/core/browser/phone_field.h" 5 #include "components/autofill/core/browser/phone_field.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 AddClassification(parsed_phone_fields_[FIELD_SUFFIX], PHONE_HOME_NUMBER, 240 AddClassification(parsed_phone_fields_[FIELD_SUFFIX], PHONE_HOME_NUMBER,
241 kBasePhoneParserScore, field_candidates); 241 kBasePhoneParserScore, field_candidates);
242 } 242 }
243 } else { 243 } else {
244 AddClassification(parsed_phone_fields_[FIELD_PHONE], 244 AddClassification(parsed_phone_fields_[FIELD_PHONE],
245 PHONE_HOME_WHOLE_NUMBER, kBasePhoneParserScore, 245 PHONE_HOME_WHOLE_NUMBER, kBasePhoneParserScore,
246 field_candidates); 246 field_candidates);
247 } 247 }
248 248
249 if (parsed_phone_fields_[FIELD_EXTENSION]) { 249 if (parsed_phone_fields_[FIELD_EXTENSION]) {
250 // TODO(crbug.com/589211): Change from UNKNOWN_TYPE to the proper 250 AddClassification(parsed_phone_fields_[FIELD_EXTENSION],
251 // ServerFieldType once the new phone suffix is checked in. 251 PHONE_HOME_EXTENSION, kBasePhoneParserScore,
252 AddClassification(parsed_phone_fields_[FIELD_EXTENSION], UNKNOWN_TYPE, 252 field_candidates);
253 kBasePhoneParserScore, field_candidates);
254 } 253 }
255 } 254 }
256 255
257 PhoneField::PhoneField() { 256 PhoneField::PhoneField() {
258 memset(parsed_phone_fields_, 0, sizeof(parsed_phone_fields_)); 257 memset(parsed_phone_fields_, 0, sizeof(parsed_phone_fields_));
259 } 258 }
260 259
261 // static 260 // static
262 std::string PhoneField::GetRegExp(RegexType regex_id) { 261 std::string PhoneField::GetRegExp(RegexType regex_id) {
263 switch (regex_id) { 262 switch (regex_id) {
(...skipping 26 matching lines...) Expand all
290 bool PhoneField::ParsePhoneField(AutofillScanner* scanner, 289 bool PhoneField::ParsePhoneField(AutofillScanner* scanner,
291 const std::string& regex, 290 const std::string& regex,
292 AutofillField** field) { 291 AutofillField** field) {
293 return ParseFieldSpecifics(scanner, 292 return ParseFieldSpecifics(scanner,
294 base::UTF8ToUTF16(regex), 293 base::UTF8ToUTF16(regex),
295 MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_NUMBER, 294 MATCH_DEFAULT | MATCH_TELEPHONE | MATCH_NUMBER,
296 field); 295 field);
297 } 296 }
298 297
299 } // namespace autofill 298 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/form_structure_unittest.cc ('k') | components/autofill/core/browser/phone_number.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698