Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: components/autofill/core/browser/autofill_field.h

Issue 1622073002: [Autofill] Remove longest common prefix from field names when running heuristics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
(...skipping 22 matching lines...) Expand all
33 const base::string16& unique_name() const { return unique_name_; } 33 const base::string16& unique_name() const { return unique_name_; }
34 34
35 const std::string& section() const { return section_; } 35 const std::string& section() const { return section_; }
36 ServerFieldType heuristic_type() const { return heuristic_type_; } 36 ServerFieldType heuristic_type() const { return heuristic_type_; }
37 ServerFieldType server_type() const { return server_type_; } 37 ServerFieldType server_type() const { return server_type_; }
38 HtmlFieldType html_type() const { return html_type_; } 38 HtmlFieldType html_type() const { return html_type_; }
39 HtmlFieldMode html_mode() const { return html_mode_; } 39 HtmlFieldMode html_mode() const { return html_mode_; }
40 const ServerFieldTypeSet& possible_types() const { return possible_types_; } 40 const ServerFieldTypeSet& possible_types() const { return possible_types_; }
41 PhonePart phone_part() const { return phone_part_; } 41 PhonePart phone_part() const { return phone_part_; }
42 bool previously_autofilled() const { return previously_autofilled_; } 42 bool previously_autofilled() const { return previously_autofilled_; }
43 const base::string16& parseable_name() const { return parseable_name_; }
43 44
44 // Setters for the detected type and section for this field. 45 // Setters for the detected type and section for this field.
45 void set_section(const std::string& section) { section_ = section; } 46 void set_section(const std::string& section) { section_ = section; }
46 void set_heuristic_type(ServerFieldType type); 47 void set_heuristic_type(ServerFieldType type);
47 void set_server_type(ServerFieldType type); 48 void set_server_type(ServerFieldType type);
48 void set_possible_types(const ServerFieldTypeSet& possible_types) { 49 void set_possible_types(const ServerFieldTypeSet& possible_types) {
49 possible_types_ = possible_types; 50 possible_types_ = possible_types;
50 } 51 }
51 void SetHtmlType(HtmlFieldType type, HtmlFieldMode mode); 52 void SetHtmlType(HtmlFieldType type, HtmlFieldMode mode);
52 void set_previously_autofilled(bool previously_autofilled) { 53 void set_previously_autofilled(bool previously_autofilled) {
53 previously_autofilled_ = previously_autofilled; 54 previously_autofilled_ = previously_autofilled;
54 } 55 }
56 void set_parseable_name(const base::string16& parseable_name) {
vabr (Chromium) 2016/01/25 10:10:25 nit: passing by value and using std::move is poten
Mathieu 2016/01/25 15:52:53 Done.
57 parseable_name_ = parseable_name;
58 }
55 59
56 // This function automatically chooses between server and heuristic autofill 60 // This function automatically chooses between server and heuristic autofill
57 // type, depending on the data available. 61 // type, depending on the data available.
58 AutofillType Type() const; 62 AutofillType Type() const;
59 63
60 // Returns true if the value of this field is empty. 64 // Returns true if the value of this field is empty.
61 bool IsEmpty() const; 65 bool IsEmpty() const;
62 66
63 // The unique signature of this field, composed of the field name and the html 67 // The unique signature of this field, composed of the field name and the html
64 // input type in a 32-bit hash. 68 // input type in a 32-bit hash.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // The default value returned by the Autofill server. 136 // The default value returned by the Autofill server.
133 std::string default_value_; 137 std::string default_value_;
134 138
135 // Used to hold the position of the first digit to be copied as a substring 139 // Used to hold the position of the first digit to be copied as a substring
136 // from credit card number. 140 // from credit card number.
137 size_t credit_card_number_offset_; 141 size_t credit_card_number_offset_;
138 142
139 // Whether the field was autofilled then later edited. 143 // Whether the field was autofilled then later edited.
140 bool previously_autofilled_; 144 bool previously_autofilled_;
141 145
146 // The parseable name attribute, with unnecessary information removed (such as
147 // a common prefix shared with other fields). Will be used for heuristics
148 // parsing.
149 base::string16 parseable_name_;
150
142 DISALLOW_COPY_AND_ASSIGN(AutofillField); 151 DISALLOW_COPY_AND_ASSIGN(AutofillField);
143 }; 152 };
144 153
145 } // namespace autofill 154 } // namespace autofill
146 155
147 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_ 156 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_FIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698