| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_CORE_BROWSER_AUTOFILL_FIELD_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 AutofillField(); | 27 AutofillField(); |
| 28 AutofillField(const FormFieldData& field, const base::string16& unique_name); | 28 AutofillField(const FormFieldData& field, const base::string16& unique_name); |
| 29 virtual ~AutofillField(); | 29 virtual ~AutofillField(); |
| 30 | 30 |
| 31 const base::string16& unique_name() const { return unique_name_; } | 31 const base::string16& unique_name() const { return unique_name_; } |
| 32 | 32 |
| 33 const std::string& section() const { return section_; } | 33 const std::string& section() const { return section_; } |
| 34 ServerFieldType heuristic_type() const { return heuristic_type_; } | 34 ServerFieldType heuristic_type() const { return heuristic_type_; } |
| 35 ServerFieldType server_type() const { return server_type_; } | 35 ServerFieldType server_type() const { return server_type_; } |
| 36 HtmlFieldType html_type() const { return html_type_; } |
| 37 HtmlFieldMode html_mode() const { return html_mode_; } |
| 36 const ServerFieldTypeSet& possible_types() const { return possible_types_; } | 38 const ServerFieldTypeSet& possible_types() const { return possible_types_; } |
| 37 PhonePart phone_part() const { return phone_part_; } | 39 PhonePart phone_part() const { return phone_part_; } |
| 38 | 40 |
| 39 // Sets the heuristic type of this field, validating the input. | 41 // Setters for the detected type and section for this field. |
| 40 void set_section(const std::string& section) { section_ = section; } | 42 void set_section(const std::string& section) { section_ = section; } |
| 41 void set_heuristic_type(ServerFieldType type); | 43 void set_heuristic_type(ServerFieldType type); |
| 42 void set_server_type(ServerFieldType type); | 44 void set_server_type(ServerFieldType type); |
| 43 void set_possible_types(const ServerFieldTypeSet& possible_types) { | 45 void set_possible_types(const ServerFieldTypeSet& possible_types) { |
| 44 possible_types_ = possible_types; | 46 possible_types_ = possible_types; |
| 45 } | 47 } |
| 46 void set_phone_part(PhonePart part) { phone_part_ = part; } | 48 void SetHtmlType(HtmlFieldType type, HtmlFieldMode mode); |
| 47 | 49 |
| 48 // This function automatically chooses between server and heuristic autofill | 50 // This function automatically chooses between server and heuristic autofill |
| 49 // type, depending on the data available. | 51 // type, depending on the data available. |
| 50 AutofillType Type() const; | 52 AutofillType Type() const; |
| 51 | 53 |
| 52 // Returns true if the value of this field is empty. | 54 // Returns true if the value of this field is empty. |
| 53 bool IsEmpty() const; | 55 bool IsEmpty() const; |
| 54 | 56 |
| 55 // The unique signature of this field, composed of the field name and the html | 57 // The unique signature of this field, composed of the field name and the html |
| 56 // input type in a 32-bit hash. | 58 // input type in a 32-bit hash. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 // The unique identifier for the section (e.g. billing vs. shipping address) | 72 // The unique identifier for the section (e.g. billing vs. shipping address) |
| 71 // that this field belongs to. | 73 // that this field belongs to. |
| 72 std::string section_; | 74 std::string section_; |
| 73 | 75 |
| 74 // The type of the field, as determined by the Autofill server. | 76 // The type of the field, as determined by the Autofill server. |
| 75 ServerFieldType server_type_; | 77 ServerFieldType server_type_; |
| 76 | 78 |
| 77 // The type of the field, as determined by the local heuristics. | 79 // The type of the field, as determined by the local heuristics. |
| 78 ServerFieldType heuristic_type_; | 80 ServerFieldType heuristic_type_; |
| 79 | 81 |
| 82 // The type of the field, as specified by the site author in HTML. |
| 83 HtmlFieldType html_type_; |
| 84 |
| 85 // The "mode" of the field, as specified by the site author in HTML. |
| 86 // Currently this is used to distinguish between billing and shipping fields. |
| 87 HtmlFieldMode html_mode_; |
| 88 |
| 80 // The set of possible types for this field. | 89 // The set of possible types for this field. |
| 81 ServerFieldTypeSet possible_types_; | 90 ServerFieldTypeSet possible_types_; |
| 82 | 91 |
| 83 // Used to track whether this field is a phone prefix or suffix. | 92 // Used to track whether this field is a phone prefix or suffix. |
| 84 PhonePart phone_part_; | 93 PhonePart phone_part_; |
| 85 | 94 |
| 86 // The default value returned by the Autofill server. | 95 // The default value returned by the Autofill server. |
| 87 std::string default_value_; | 96 std::string default_value_; |
| 88 | 97 |
| 89 DISALLOW_COPY_AND_ASSIGN(AutofillField); | 98 DISALLOW_COPY_AND_ASSIGN(AutofillField); |
| 90 }; | 99 }; |
| 91 | 100 |
| 92 } // namespace autofill | 101 } // namespace autofill |
| 93 | 102 |
| 94 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ | 103 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ |
| OLD | NEW |