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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // input type in a 32-bit hash. | 58 // input type in a 32-bit hash. |
59 std::string FieldSignature() const; | 59 std::string FieldSignature() const; |
60 | 60 |
61 // Returns true if the field type has been determined (without the text in the | 61 // Returns true if the field type has been determined (without the text in the |
62 // field). | 62 // field). |
63 bool IsFieldFillable() const; | 63 bool IsFieldFillable() const; |
64 | 64 |
65 void set_default_value(const std::string& value) { default_value_ = value; } | 65 void set_default_value(const std::string& value) { default_value_ = value; } |
66 const std::string& default_value() const { return default_value_; } | 66 const std::string& default_value() const { return default_value_; } |
67 | 67 |
| 68 void set_credit_card_number_offset(size_t position) { |
| 69 credit_card_number_offset_ = position; |
| 70 } |
| 71 size_t credit_card_number_offset() const { |
| 72 return credit_card_number_offset_; |
| 73 } |
| 74 |
68 // Set |field_data|'s value to |value|. Uses |field|, |address_language_code|, | 75 // Set |field_data|'s value to |value|. Uses |field|, |address_language_code|, |
69 // and |app_locale| as hints when filling exceptional cases like phone number | 76 // and |app_locale| as hints when filling exceptional cases like phone number |
70 // values and <select> fields. Returns |true| if the field has been filled, | 77 // values and <select> fields. Returns |true| if the field has been filled, |
71 // |false| otherwise. | 78 // |false| otherwise. |
72 static bool FillFormField(const AutofillField& field, | 79 static bool FillFormField(const AutofillField& field, |
73 const base::string16& value, | 80 const base::string16& value, |
74 const std::string& address_language_code, | 81 const std::string& address_language_code, |
75 const std::string& app_locale, | 82 const std::string& app_locale, |
76 FormFieldData* field_data); | 83 FormFieldData* field_data); |
77 | 84 |
(...skipping 20 matching lines...) Expand all Loading... |
98 | 105 |
99 // The set of possible types for this field. | 106 // The set of possible types for this field. |
100 ServerFieldTypeSet possible_types_; | 107 ServerFieldTypeSet possible_types_; |
101 | 108 |
102 // Used to track whether this field is a phone prefix or suffix. | 109 // Used to track whether this field is a phone prefix or suffix. |
103 PhonePart phone_part_; | 110 PhonePart phone_part_; |
104 | 111 |
105 // The default value returned by the Autofill server. | 112 // The default value returned by the Autofill server. |
106 std::string default_value_; | 113 std::string default_value_; |
107 | 114 |
| 115 // Used to hold the position of the first digit to be copied as a substring |
| 116 // from credit card number. |
| 117 size_t credit_card_number_offset_; |
| 118 |
108 DISALLOW_COPY_AND_ASSIGN(AutofillField); | 119 DISALLOW_COPY_AND_ASSIGN(AutofillField); |
109 }; | 120 }; |
110 | 121 |
111 } // namespace autofill | 122 } // namespace autofill |
112 | 123 |
113 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ | 124 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ |
OLD | NEW |