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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_NAME_FIELD_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_NAME_FIELD_H_ 7 8 #include <vector> 9 10 #include "base/compiler_specific.h" 11 #include "base/gtest_prod_util.h" 12 #include "components/autofill/core/browser/autofill_field.h" 13 #include "components/autofill/core/browser/form_field.h" 14 15 namespace autofill { 16 17 class AutofillScanner; 18 19 // A form field that can parse either a FullNameField or a FirstLastNameField. 20 class NameField : public FormField { 21 public: 22 static FormField* Parse(AutofillScanner* scanner); 23 24 protected: 25 NameField() {} 26 27 // FormField: 28 virtual bool ClassifyField(ServerFieldTypeMap* map) const OVERRIDE; 29 30 private: 31 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLast); 32 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLast2); 33 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLast); 34 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLast2); 35 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLastMiddleWithSpaces); 36 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstLastEmpty); 37 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, FirstMiddleLastEmpty); 38 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, MiddleInitial); 39 FRIEND_TEST_ALL_PREFIXES(NameFieldTest, MiddleInitialAtEnd); 40 41 DISALLOW_COPY_AND_ASSIGN(NameField); 42 }; 43 44 } // namespace autofill 45 46 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_NAME_FIELD_H_ 47