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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ 6 #define CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ 7 #pragma once 8 9 #include <vector> 10 11 #include "chrome/browser/autofill/autofill_field.h" 12 #include "chrome/browser/autofill/form_field.h" 13 14 // A form field that can parse either a FullNameField or a FirstLastNameField. 15 class NameField : public FormField { 16 public: 17 static NameField* Parse(std::vector<AutofillField*>::const_iterator* iter, 18 bool is_ecml); 19 20 protected: 21 NameField() {} 22 23 private: 24 DISALLOW_COPY_AND_ASSIGN(NameField); 25 }; 26 27 // A form field that can parse a full name field. 28 class FullNameField : public NameField { 29 public: 30 virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const; 31 32 static FullNameField* Parse( 33 std::vector<AutofillField*>::const_iterator* iter); 34 35 private: 36 explicit FullNameField(AutofillField* field); 37 38 AutofillField* field_; 39 DISALLOW_COPY_AND_ASSIGN(FullNameField); 40 }; 41 42 // A form field that can parse a first and last name field. 43 class FirstLastNameField : public NameField { 44 public: 45 static FirstLastNameField* Parse1( 46 std::vector<AutofillField*>::const_iterator* iter); 47 static FirstLastNameField* Parse2( 48 std::vector<AutofillField*>::const_iterator* iter); 49 static FirstLastNameField* ParseEcmlName( 50 std::vector<AutofillField*>::const_iterator* iter); 51 static FirstLastNameField* Parse( 52 std::vector<AutofillField*>::const_iterator* iter, bool is_ecml); 53 54 virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const; 55 56 private: 57 FirstLastNameField(); 58 59 AutofillField* first_name_; 60 AutofillField* middle_name_; // Optional. 61 AutofillField* last_name_; 62 bool middle_initial_; // True if middle_name_ is a middle initial. 63 64 DISALLOW_COPY_AND_ASSIGN(FirstLastNameField); 65 }; 66 67 #endif // CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ 68