| 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/email_field.h" | 5 #include "chrome/browser/autofill/email_field.h" |
| 6 | 6 |
| 7 #include "chrome/browser/autofill/autofill_ecml.h" | 7 #include "chrome/browser/autofill/autofill_ecml.h" |
| 8 #include "chrome/browser/autofill/autofill_scanner.h" | 8 #include "chrome/browser/autofill/autofill_scanner.h" |
| 9 #include "grit/autofill_resources.h" | 9 #include "grit/autofill_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 11 | 11 |
| 12 using autofill::GetEcmlPattern; | 12 using autofill::GetEcmlPattern; |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 EmailField* EmailField::Parse(AutofillScanner* scanner, bool is_ecml) { | 15 EmailField* EmailField::Parse(AutofillScanner* scanner, bool is_ecml) { |
| 16 string16 pattern; | 16 string16 pattern; |
| 17 if (is_ecml) | 17 if (is_ecml) |
| 18 pattern = GetEcmlPattern(kEcmlShipToEmail, kEcmlBillToEmail, '|'); | 18 pattern = GetEcmlPattern(kEcmlShipToEmail, kEcmlBillToEmail, '|'); |
| 19 else | 19 else |
| 20 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_EMAIL_RE); | 20 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_EMAIL_RE); |
| 21 | 21 |
| 22 const AutofillField* field; | 22 const AutofillField* field; |
| 23 if (ParseField(scanner, pattern, &field)) | 23 if (ParseFieldSpecifics(scanner, pattern, |
| 24 MATCH_DEFAULT | MATCH_EMAIL, &field)) { |
| 24 return new EmailField(field); | 25 return new EmailField(field); |
| 26 } |
| 25 | 27 |
| 26 return NULL; | 28 return NULL; |
| 27 } | 29 } |
| 28 | 30 |
| 29 EmailField::EmailField(const AutofillField* field) : field_(field) { | 31 EmailField::EmailField(const AutofillField* field) : field_(field) { |
| 30 } | 32 } |
| 31 | 33 |
| 32 bool EmailField::ClassifyField(FieldTypeMap* map) const { | 34 bool EmailField::ClassifyField(FieldTypeMap* map) const { |
| 33 return AddClassification(field_, EMAIL_ADDRESS, map); | 35 return AddClassification(field_, EMAIL_ADDRESS, map); |
| 34 } | 36 } |
| OLD | NEW |