| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_FIELD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_FIELD_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_FIELD_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_FIELD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "components/autofill/browser/field_types.h" | 12 #include "components/autofill/browser/field_types.h" |
| 13 #include "components/autofill/common/form_field_data.h" | 13 #include "components/autofill/common/form_field_data.h" |
| 14 | 14 |
| 15 class AutofillField : public FormFieldData { | 15 class AutofillField : public FormFieldData { |
| 16 public: | 16 public: |
| 17 enum PhonePart { | 17 enum PhonePart { |
| 18 IGNORED = 0, | 18 IGNORED = 0, |
| 19 PHONE_PREFIX = 1, | 19 PHONE_PREFIX = 1, |
| 20 PHONE_SUFFIX = 2, | 20 PHONE_SUFFIX = 2, |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 AutofillField(); | 23 AutofillField(); |
| 24 AutofillField(const FormFieldData& field, const string16& unique_name); | 24 AutofillField(const FormFieldData& field, const base::string16& unique_name); |
| 25 virtual ~AutofillField(); | 25 virtual ~AutofillField(); |
| 26 | 26 |
| 27 const string16& unique_name() const { return unique_name_; } | 27 const base::string16& unique_name() const { return unique_name_; } |
| 28 | 28 |
| 29 const std::string& section() const { return section_; } | 29 const std::string& section() const { return section_; } |
| 30 AutofillFieldType heuristic_type() const { return heuristic_type_; } | 30 AutofillFieldType heuristic_type() const { return heuristic_type_; } |
| 31 AutofillFieldType server_type() const { return server_type_; } | 31 AutofillFieldType server_type() const { return server_type_; } |
| 32 const FieldTypeSet& possible_types() const { return possible_types_; } | 32 const FieldTypeSet& possible_types() const { return possible_types_; } |
| 33 PhonePart phone_part() const { return phone_part_; } | 33 PhonePart phone_part() const { return phone_part_; } |
| 34 | 34 |
| 35 // Sets the heuristic type of this field, validating the input. | 35 // Sets the heuristic type of this field, validating the input. |
| 36 void set_section(const std::string& section) { section_ = section; } | 36 void set_section(const std::string& section) { section_ = section; } |
| 37 void set_heuristic_type(AutofillFieldType type); | 37 void set_heuristic_type(AutofillFieldType type); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 54 | 54 |
| 55 // Returns true if the field type has been determined (without the text in the | 55 // Returns true if the field type has been determined (without the text in the |
| 56 // field). | 56 // field). |
| 57 bool IsFieldFillable() const; | 57 bool IsFieldFillable() const; |
| 58 | 58 |
| 59 void set_default_value(const std::string& value) { default_value_ = value; } | 59 void set_default_value(const std::string& value) { default_value_ = value; } |
| 60 const std::string& default_value() const { return default_value_; } | 60 const std::string& default_value() const { return default_value_; } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 // The unique name of this field, generated by Autofill. | 63 // The unique name of this field, generated by Autofill. |
| 64 string16 unique_name_; | 64 base::string16 unique_name_; |
| 65 | 65 |
| 66 // The unique identifier for the section (e.g. billing vs. shipping address) | 66 // The unique identifier for the section (e.g. billing vs. shipping address) |
| 67 // that this field belongs to. | 67 // that this field belongs to. |
| 68 std::string section_; | 68 std::string section_; |
| 69 | 69 |
| 70 // The type of the field, as determined by the Autofill server. | 70 // The type of the field, as determined by the Autofill server. |
| 71 AutofillFieldType server_type_; | 71 AutofillFieldType server_type_; |
| 72 | 72 |
| 73 // The type of the field, as determined by the local heuristics. | 73 // The type of the field, as determined by the local heuristics. |
| 74 AutofillFieldType heuristic_type_; | 74 AutofillFieldType heuristic_type_; |
| 75 | 75 |
| 76 // The set of possible types for this field. | 76 // The set of possible types for this field. |
| 77 FieldTypeSet possible_types_; | 77 FieldTypeSet possible_types_; |
| 78 | 78 |
| 79 // Used to track whether this field is a phone prefix or suffix. | 79 // Used to track whether this field is a phone prefix or suffix. |
| 80 PhonePart phone_part_; | 80 PhonePart phone_part_; |
| 81 | 81 |
| 82 // The default value returned by the Autofill server. | 82 // The default value returned by the Autofill server. |
| 83 std::string default_value_; | 83 std::string default_value_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(AutofillField); | 85 DISALLOW_COPY_AND_ASSIGN(AutofillField); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_FIELD_H_ | 88 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_FIELD_H_ |
| OLD | NEW |