| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ | 6 #define CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/logging.h" | |
| 12 #include "chrome/browser/autofill/autofill_field.h" | 11 #include "chrome/browser/autofill/autofill_field.h" |
| 13 #include "chrome/browser/autofill/form_field.h" | 12 #include "chrome/browser/autofill/form_field.h" |
| 14 | 13 |
| 15 // A form field that can parse either a FullNameField or a FirstLastNameField. | 14 // A form field that can parse either a FullNameField or a FirstLastNameField. |
| 16 class NameField : public FormField { | 15 class NameField : public FormField { |
| 17 public: | 16 public: |
| 18 static NameField* Parse(std::vector<AutoFillField*>::const_iterator* iter, | 17 static NameField* Parse(std::vector<AutoFillField*>::const_iterator* iter, |
| 19 bool is_ecml); | 18 bool is_ecml); |
| 20 | 19 |
| 21 protected: | 20 protected: |
| 22 NameField() {} | 21 NameField() {} |
| 23 | 22 |
| 24 private: | 23 private: |
| 25 DISALLOW_COPY_AND_ASSIGN(NameField); | 24 DISALLOW_COPY_AND_ASSIGN(NameField); |
| 26 }; | 25 }; |
| 27 | 26 |
| 28 // A form field that can parse a full name field. | 27 // A form field that can parse a full name field. |
| 29 class FullNameField : public NameField { | 28 class FullNameField : public NameField { |
| 30 public: | 29 public: |
| 31 virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const { | 30 virtual bool GetFieldInfo(FieldTypeMap* field_type_map) const; |
| 32 bool ok = Add(field_type_map, field_, AutoFillType(NAME_FULL)); | |
| 33 DCHECK(ok); | |
| 34 return true; | |
| 35 } | |
| 36 | 31 |
| 37 static FullNameField* Parse( | 32 static FullNameField* Parse( |
| 38 std::vector<AutoFillField*>::const_iterator* iter); | 33 std::vector<AutoFillField*>::const_iterator* iter); |
| 39 | 34 |
| 40 private: | 35 private: |
| 41 explicit FullNameField(AutoFillField* field) : field_(field) {} | 36 explicit FullNameField(AutoFillField* field); |
| 42 | 37 |
| 43 AutoFillField* field_; | 38 AutoFillField* field_; |
| 44 DISALLOW_COPY_AND_ASSIGN(FullNameField); | 39 DISALLOW_COPY_AND_ASSIGN(FullNameField); |
| 45 }; | 40 }; |
| 46 | 41 |
| 47 // A form field that can parse a first and last name field. | 42 // A form field that can parse a first and last name field. |
| 48 class FirstLastNameField : public NameField { | 43 class FirstLastNameField : public NameField { |
| 49 public: | 44 public: |
| 50 static FirstLastNameField* Parse1( | 45 static FirstLastNameField* Parse1( |
| 51 std::vector<AutoFillField*>::const_iterator* iter); | 46 std::vector<AutoFillField*>::const_iterator* iter); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 63 | 58 |
| 64 AutoFillField* first_name_; | 59 AutoFillField* first_name_; |
| 65 AutoFillField* middle_name_; // Optional. | 60 AutoFillField* middle_name_; // Optional. |
| 66 AutoFillField* last_name_; | 61 AutoFillField* last_name_; |
| 67 bool middle_initial_; // True if middle_name_ is a middle initial. | 62 bool middle_initial_; // True if middle_name_ is a middle initial. |
| 68 | 63 |
| 69 DISALLOW_COPY_AND_ASSIGN(FirstLastNameField); | 64 DISALLOW_COPY_AND_ASSIGN(FirstLastNameField); |
| 70 }; | 65 }; |
| 71 | 66 |
| 72 #endif // CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ | 67 #endif // CHROME_BROWSER_AUTOFILL_NAME_FIELD_H_ |
| OLD | NEW |