| 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_AUTOFILL_TYPE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Phone subgroups. | 40 // Phone subgroups. |
| 41 PHONE_NUMBER, | 41 PHONE_NUMBER, |
| 42 PHONE_CITY_CODE, | 42 PHONE_CITY_CODE, |
| 43 PHONE_COUNTRY_CODE, | 43 PHONE_COUNTRY_CODE, |
| 44 PHONE_CITY_AND_NUMBER, | 44 PHONE_CITY_AND_NUMBER, |
| 45 PHONE_WHOLE_NUMBER | 45 PHONE_WHOLE_NUMBER |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 struct AutoFillTypeDefinition { | 48 struct AutoFillTypeDefinition { |
| 49 AutoFillFieldType field_type; | |
| 50 FieldTypeGroup group; | 49 FieldTypeGroup group; |
| 51 FieldTypeSubGroup subgroup; | 50 FieldTypeSubGroup subgroup; |
| 52 std::string name; | |
| 53 }; | 51 }; |
| 54 | 52 |
| 55 AutoFillType() {} | |
| 56 explicit AutoFillType(AutoFillTypeDefinition* definition); | |
| 57 explicit AutoFillType(AutoFillFieldType field_type); | 53 explicit AutoFillType(AutoFillFieldType field_type); |
| 54 AutoFillType(const AutoFillType& autofill_type); |
| 55 AutoFillType& operator=(const AutoFillType& autofill_type); |
| 58 | 56 |
| 59 AutoFillFieldType field_type() const { | 57 AutoFillFieldType field_type() const; |
| 60 return autofill_type_definition_->field_type; | 58 FieldTypeGroup group() const; |
| 61 } | 59 FieldTypeSubGroup subgroup() const; |
| 62 FieldTypeGroup group() const { return autofill_type_definition_->group; } | |
| 63 FieldTypeSubGroup subgroup() const { | |
| 64 return autofill_type_definition_->subgroup; | |
| 65 } | |
| 66 | 60 |
| 67 private: | 61 private: |
| 68 static void StaticInitialize(); | 62 AutoFillFieldType field_type_; |
| 69 static void InitializeFieldTypeMap(); | |
| 70 | |
| 71 static bool initialized_; | |
| 72 static AutoFillType types_[MAX_VALID_FIELD_TYPE + 1]; | |
| 73 | |
| 74 const AutoFillTypeDefinition* autofill_type_definition_; | |
| 75 }; | 63 }; |
| 76 | 64 |
| 77 typedef AutoFillType::FieldTypeGroup FieldTypeGroup; | 65 typedef AutoFillType::FieldTypeGroup FieldTypeGroup; |
| 78 typedef AutoFillType::FieldTypeSubGroup FieldTypeSubGroup; | 66 typedef AutoFillType::FieldTypeSubGroup FieldTypeSubGroup; |
| 79 typedef std::set<AutoFillFieldType> FieldTypeSet; | 67 typedef std::set<AutoFillFieldType> FieldTypeSet; |
| 80 typedef std::map<string16, AutoFillFieldType> FieldTypeMap; | 68 typedef std::map<string16, AutoFillFieldType> FieldTypeMap; |
| 81 | 69 |
| 82 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ | 70 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ |
| OLD | NEW |