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 #include "components/autofill/core/browser/email_field.h" | 5 #include "components/autofill/core/browser/email_field.h" |
6 | 6 |
7 #include "base/logging.h" | |
7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
8 #include "components/autofill/core/browser/autofill_regex_constants.h" | 9 #include "components/autofill/core/browser/autofill_regex_constants.h" |
9 #include "components/autofill/core/browser/autofill_scanner.h" | 10 #include "components/autofill/core/browser/autofill_scanner.h" |
10 | 11 |
11 namespace autofill { | 12 namespace autofill { |
12 | 13 |
13 // static | 14 // static |
14 scoped_ptr<FormField> EmailField::Parse(AutofillScanner* scanner) { | 15 scoped_ptr<FormField> EmailField::Parse(AutofillScanner* scanner) { |
15 AutofillField* field; | 16 AutofillField* field; |
16 if (ParseFieldSpecifics(scanner, base::UTF8ToUTF16(kEmailRe), | 17 if (ParseFieldSpecifics(scanner, base::UTF8ToUTF16(kEmailRe), |
17 MATCH_DEFAULT | MATCH_EMAIL, &field)) { | 18 MATCH_DEFAULT | MATCH_EMAIL, &field)) { |
18 return make_scoped_ptr(new EmailField(field)); | 19 return make_scoped_ptr(new EmailField(field)); |
19 } | 20 } |
20 | 21 |
21 return NULL; | 22 return NULL; |
22 } | 23 } |
23 | 24 |
24 EmailField::EmailField(const AutofillField* field) : field_(field) { | 25 EmailField::EmailField(const AutofillField* field) : field_(field) { |
26 DCHECK(field); | |
Evan Stade
2015/01/22 23:43:44
if you want to enforce this, I think the param sho
Lei Zhang
2015/01/22 23:58:12
Reverted.
| |
25 } | 27 } |
26 | 28 |
27 bool EmailField::ClassifyField(ServerFieldTypeMap* map) const { | 29 bool EmailField::ClassifyField(ServerFieldTypeMap* map) const { |
28 return AddClassification(field_, EMAIL_ADDRESS, map); | 30 return AddClassification(field_, EMAIL_ADDRESS, map); |
29 } | 31 } |
30 | 32 |
31 } // namespace autofill | 33 } // namespace autofill |
OLD | NEW |