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

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

Issue 22040002: [Autofill] Add a separate enumeration for HTML field type hints. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add docs Created 7 years, 4 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 | Annotate | Revision Log
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_FORM_STRUCTURE_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 30 matching lines...) Expand all
41 class AutofillMetrics; 41 class AutofillMetrics;
42 42
43 struct AutocheckoutPageMetaData; 43 struct AutocheckoutPageMetaData;
44 struct FormData; 44 struct FormData;
45 struct FormDataPredictions; 45 struct FormDataPredictions;
46 46
47 // FormStructure stores a single HTML form together with the values entered 47 // FormStructure stores a single HTML form together with the values entered
48 // in the fields along with additional information needed by Autofill. 48 // in the fields along with additional information needed by Autofill.
49 class FormStructure { 49 class FormStructure {
50 public: 50 public:
51 // Whether the form fields should be parsed to match the semantics of plain
52 // ol' Autofill, or of the interactive Autofill dialog.
53 enum ParseTarget {
54 PARSE_FOR_AUTOFILL,
55 PARSE_FOR_AUTOFILL_DIALOG,
56 };
57
58 FormStructure(const FormData& form, 51 FormStructure(const FormData& form,
59 const std::string& autocheckout_url_prefix); 52 const std::string& autocheckout_url_prefix);
60 virtual ~FormStructure(); 53 virtual ~FormStructure();
61 54
62 // Runs several heuristics against the form fields to determine their possible 55 // Runs several heuristics against the form fields to determine their possible
63 // types. 56 // types.
64 void DetermineHeuristicTypes(const AutofillMetrics& metric_logger); 57 void DetermineHeuristicTypes(const AutofillMetrics& metric_logger);
65 58
66 // Encodes the XML upload request from this FormStructure. 59 // Encodes the XML upload request from this FormStructure.
67 bool EncodeUploadRequest(const NativeFieldTypeSet& available_field_types, 60 bool EncodeUploadRequest(const NativeFieldTypeSet& available_field_types,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // set for each field. |interaction_time| should be a timestamp corresponding 124 // set for each field. |interaction_time| should be a timestamp corresponding
132 // to the user's first interaction with the form. |submission_time| should be 125 // to the user's first interaction with the form. |submission_time| should be
133 // a timestamp corresponding to the form's submission. 126 // a timestamp corresponding to the form's submission.
134 void LogQualityMetrics(const AutofillMetrics& metric_logger, 127 void LogQualityMetrics(const AutofillMetrics& metric_logger,
135 const base::TimeTicks& load_time, 128 const base::TimeTicks& load_time,
136 const base::TimeTicks& interaction_time, 129 const base::TimeTicks& interaction_time,
137 const base::TimeTicks& submission_time) const; 130 const base::TimeTicks& submission_time) const;
138 131
139 // Classifies each field in |fields_| based upon its |autocomplete| attribute, 132 // Classifies each field in |fields_| based upon its |autocomplete| attribute,
140 // if the attribute is available. The association is stored into the field's 133 // if the attribute is available. The association is stored into the field's
141 // |heuristic_type|. The exact method of classification depends on 134 // |heuristic_type|.
142 // |parse_target|, as the Autofill dialog has slightly different semantics
143 // from regular ol' Autofill.
144 // Fills |found_types| with |true| if the attribute is available and neither 135 // Fills |found_types| with |true| if the attribute is available and neither
145 // empty nor set to the special values "on" or "off" for at least one field. 136 // empty nor set to the special values "on" or "off" for at least one field.
146 // Fills |found_sections| with |true| if the attribute specifies a section for 137 // Fills |found_sections| with |true| if the attribute specifies a section for
147 // at least one field. 138 // at least one field.
148 void ParseFieldTypesFromAutocompleteAttributes(ParseTarget parse_target, 139 void ParseFieldTypesFromAutocompleteAttributes(bool* found_types,
149 bool* found_types,
150 bool* found_sections); 140 bool* found_sections);
151 141
152 const AutofillField* field(size_t index) const; 142 const AutofillField* field(size_t index) const;
153 AutofillField* field(size_t index); 143 AutofillField* field(size_t index);
154 size_t field_count() const; 144 size_t field_count() const;
155 145
156 // Returns the number of fields that are able to be autofilled. 146 // Returns the number of fields that are able to be autofilled.
157 size_t autofill_count() const { return autofill_count_; } 147 size_t autofill_count() const { return autofill_count_; }
158 148
159 // Used for iterating over the fields. 149 // Used for iterating over the fields.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 253
264 // Whether or not this form was filled by Autocheckout. 254 // Whether or not this form was filled by Autocheckout.
265 bool filled_by_autocheckout_; 255 bool filled_by_autocheckout_;
266 256
267 DISALLOW_COPY_AND_ASSIGN(FormStructure); 257 DISALLOW_COPY_AND_ASSIGN(FormStructure);
268 }; 258 };
269 259
270 } // namespace autofill 260 } // namespace autofill
271 261
272 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ 262 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698