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 3 // found in the LICENSE file. 4 5 #include "components/autofill/core/browser/email_field.h" 6 7 #include "base/strings/utf_string_conversions.h" 8 #include "components/autofill/core/browser/autofill_regex_constants.h" 9 #include "components/autofill/core/browser/autofill_scanner.h" 10 #include "ui/base/l10n/l10n_util.h" 11 12 namespace autofill { 13 14 // static Parse(AutofillScanner * scanner)15FormField* EmailField::Parse(AutofillScanner* scanner) { 16 AutofillField* field; 17 if (ParseFieldSpecifics(scanner, base::UTF8ToUTF16(autofill::kEmailRe), 18 MATCH_DEFAULT | MATCH_EMAIL, &field)) { 19 return new EmailField(field); 20 } 21 22 return NULL; 23 } 24 EmailField(const AutofillField * field)25EmailField::EmailField(const AutofillField* field) : field_(field) { 26 } 27 ClassifyField(ServerFieldTypeMap * map) const28bool EmailField::ClassifyField(ServerFieldTypeMap* map) const { 29 return AddClassification(field_, EMAIL_ADDRESS, map); 30 } 31 32 } // namespace autofill 33