| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "components/autofill/core/browser/field_types.h" | 14 #include "components/autofill/core/browser/field_types.h" |
| 15 #include "components/autofill/core/browser/proto/server.pb.h" |
| 15 #include "components/autofill/core/common/form_field_data.h" | 16 #include "components/autofill/core/common/form_field_data.h" |
| 16 | 17 |
| 17 namespace autofill { | 18 namespace autofill { |
| 18 | 19 |
| 19 class AutofillType; | 20 class AutofillType; |
| 20 | 21 |
| 21 class AutofillField : public FormFieldData { | 22 class AutofillField : public FormFieldData { |
| 22 public: | 23 public: |
| 23 enum PhonePart { | 24 enum PhonePart { |
| 24 IGNORED = 0, | 25 IGNORED = 0, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void set_default_value(const std::string& value) { default_value_ = value; } | 76 void set_default_value(const std::string& value) { default_value_ = value; } |
| 76 const std::string& default_value() const { return default_value_; } | 77 const std::string& default_value() const { return default_value_; } |
| 77 | 78 |
| 78 void set_credit_card_number_offset(size_t position) { | 79 void set_credit_card_number_offset(size_t position) { |
| 79 credit_card_number_offset_ = position; | 80 credit_card_number_offset_ = position; |
| 80 } | 81 } |
| 81 size_t credit_card_number_offset() const { | 82 size_t credit_card_number_offset() const { |
| 82 return credit_card_number_offset_; | 83 return credit_card_number_offset_; |
| 83 } | 84 } |
| 84 | 85 |
| 86 void set_generation_type( |
| 87 AutofillUploadContents::Field::PasswordGenerationType type) { |
| 88 generation_type_ = type; |
| 89 } |
| 90 AutofillUploadContents::Field::PasswordGenerationType generation_type() |
| 91 const { |
| 92 return generation_type_; |
| 93 } |
| 94 |
| 85 // Set |field_data|'s value to |value|. Uses |field|, |address_language_code|, | 95 // Set |field_data|'s value to |value|. Uses |field|, |address_language_code|, |
| 86 // and |app_locale| as hints when filling exceptional cases like phone number | 96 // and |app_locale| as hints when filling exceptional cases like phone number |
| 87 // values and <select> fields. Returns |true| if the field has been filled, | 97 // values and <select> fields. Returns |true| if the field has been filled, |
| 88 // |false| otherwise. | 98 // |false| otherwise. |
| 89 static bool FillFormField(const AutofillField& field, | 99 static bool FillFormField(const AutofillField& field, |
| 90 const base::string16& value, | 100 const base::string16& value, |
| 91 const std::string& address_language_code, | 101 const std::string& address_language_code, |
| 92 const std::string& app_locale, | 102 const std::string& app_locale, |
| 93 FormFieldData* field_data); | 103 FormFieldData* field_data); |
| 94 | 104 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 size_t credit_card_number_offset_; | 151 size_t credit_card_number_offset_; |
| 142 | 152 |
| 143 // Whether the field was autofilled then later edited. | 153 // Whether the field was autofilled then later edited. |
| 144 bool previously_autofilled_; | 154 bool previously_autofilled_; |
| 145 | 155 |
| 146 // The parseable name attribute, with unnecessary information removed (such as | 156 // The parseable name attribute, with unnecessary information removed (such as |
| 147 // a common prefix shared with other fields). Will be used for heuristics | 157 // a common prefix shared with other fields). Will be used for heuristics |
| 148 // parsing. | 158 // parsing. |
| 149 base::string16 parseable_name_; | 159 base::string16 parseable_name_; |
| 150 | 160 |
| 161 // The type of password generation event, if it happened. |
| 162 AutofillUploadContents::Field::PasswordGenerationType generation_type_; |
| 163 |
| 151 DISALLOW_COPY_AND_ASSIGN(AutofillField); | 164 DISALLOW_COPY_AND_ASSIGN(AutofillField); |
| 152 }; | 165 }; |
| 153 | 166 |
| 154 } // namespace autofill | 167 } // namespace autofill |
| 155 | 168 |
| 156 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ | 169 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ |
| OLD | NEW |