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

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

Issue 23033016: Remove autocheckout code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more deletes, and Ilya review. Created 7 years, 3 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 22 matching lines...) Expand all
33 } 33 }
34 34
35 namespace buzz { 35 namespace buzz {
36 class XmlElement; 36 class XmlElement;
37 } 37 }
38 38
39 namespace autofill { 39 namespace autofill {
40 40
41 class AutofillMetrics; 41 class AutofillMetrics;
42 42
43 struct AutocheckoutPageMetaData;
44 struct FormData; 43 struct FormData;
45 struct FormDataPredictions; 44 struct FormDataPredictions;
46 45
47 // FormStructure stores a single HTML form together with the values entered 46 // FormStructure stores a single HTML form together with the values entered
48 // in the fields along with additional information needed by Autofill. 47 // in the fields along with additional information needed by Autofill.
49 class FormStructure { 48 class FormStructure {
50 public: 49 public:
51 FormStructure(const FormData& form, 50 FormStructure(const FormData& form);
52 const std::string& autocheckout_url_prefix);
53 virtual ~FormStructure(); 51 virtual ~FormStructure();
54 52
55 // Runs several heuristics against the form fields to determine their possible 53 // Runs several heuristics against the form fields to determine their possible
56 // types. 54 // types.
57 void DetermineHeuristicTypes(const AutofillMetrics& metric_logger); 55 void DetermineHeuristicTypes(const AutofillMetrics& metric_logger);
58 56
59 // Encodes the XML upload request from this FormStructure. 57 // Encodes the XML upload request from this FormStructure.
60 bool EncodeUploadRequest(const ServerFieldTypeSet& available_field_types, 58 bool EncodeUploadRequest(const ServerFieldTypeSet& available_field_types,
61 bool form_was_autofilled, 59 bool form_was_autofilled,
62 std::string* encoded_xml) const; 60 std::string* encoded_xml) const;
(...skipping 12 matching lines...) Expand all
75 // second, and the rest is for the third. 73 // second, and the rest is for the third.
76 static bool EncodeQueryRequest(const std::vector<FormStructure*>& forms, 74 static bool EncodeQueryRequest(const std::vector<FormStructure*>& forms,
77 std::vector<std::string>* encoded_signatures, 75 std::vector<std::string>* encoded_signatures,
78 std::string* encoded_xml); 76 std::string* encoded_xml);
79 77
80 // Parses the field types from the server query response. |forms| must be the 78 // Parses the field types from the server query response. |forms| must be the
81 // same as the one passed to EncodeQueryRequest when constructing the query. 79 // same as the one passed to EncodeQueryRequest when constructing the query.
82 static void ParseQueryResponse( 80 static void ParseQueryResponse(
83 const std::string& response_xml, 81 const std::string& response_xml,
84 const std::vector<FormStructure*>& forms, 82 const std::vector<FormStructure*>& forms,
85 autofill::AutocheckoutPageMetaData* page_meta_data,
86 const AutofillMetrics& metric_logger); 83 const AutofillMetrics& metric_logger);
87 84
88 // Fills |forms| with the details from the given |form_structures| and their 85 // Fills |forms| with the details from the given |form_structures| and their
89 // fields' predicted types. 86 // fields' predicted types.
90 static void GetFieldTypePredictions( 87 static void GetFieldTypePredictions(
91 const std::vector<FormStructure*>& form_structures, 88 const std::vector<FormStructure*>& form_structures,
92 std::vector<FormDataPredictions>* forms); 89 std::vector<FormDataPredictions>* forms);
93 90
94 // The unique signature for this form, composed of the target url domain, 91 // The unique signature for this form, composed of the target url domain,
95 // the form name, and the form field names in a 64-bit hash. 92 // the form name, and the form field names in a 64-bit hash.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 const GURL& source_url() const { return source_url_; } 154 const GURL& source_url() const { return source_url_; }
158 155
159 UploadRequired upload_required() const { return upload_required_; } 156 UploadRequired upload_required() const { return upload_required_; }
160 157
161 virtual std::string server_experiment_id() const; 158 virtual std::string server_experiment_id() const;
162 159
163 // Returns a FormData containing the data this form structure knows about. 160 // Returns a FormData containing the data this form structure knows about.
164 // |user_submitted| is currently always false. 161 // |user_submitted| is currently always false.
165 FormData ToFormData() const; 162 FormData ToFormData() const;
166 163
167 bool filled_by_autocheckout() const { return filled_by_autocheckout_; }
168 void set_filled_by_autocheckout(bool filled_by_autocheckout) {
169 filled_by_autocheckout_ = filled_by_autocheckout;
170 }
171
172 bool operator==(const FormData& form) const; 164 bool operator==(const FormData& form) const;
173 bool operator!=(const FormData& form) const; 165 bool operator!=(const FormData& form) const;
174 166
175 private: 167 private:
176 friend class FormStructureTest; 168 friend class FormStructureTest;
177 FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, QueryAndUploadTest); 169 FRIEND_TEST_ALL_PREFIXES(AutofillDownloadTest, QueryAndUploadTest);
178 170
179 // 64-bit hash of the string - used in FormSignature and unit-tests. 171 // 64-bit hash of the string - used in FormSignature and unit-tests.
180 static std::string Hash64Bit(const std::string& str); 172 static std::string Hash64Bit(const std::string& str);
181 173
(...skipping 10 matching lines...) Expand all
192 184
193 // Classifies each field in |fields_| into a logical section. 185 // Classifies each field in |fields_| into a logical section.
194 // Sections are identified by the heuristic that a logical section should not 186 // Sections are identified by the heuristic that a logical section should not
195 // include multiple fields of the same autofill type (with some exceptions, as 187 // include multiple fields of the same autofill type (with some exceptions, as
196 // described in the implementation). Sections are furthermore distinguished 188 // described in the implementation). Sections are furthermore distinguished
197 // as either credit card or non-credit card sections. 189 // as either credit card or non-credit card sections.
198 // If |has_author_specified_sections| is true, only the second pass -- 190 // If |has_author_specified_sections| is true, only the second pass --
199 // distinguishing credit card sections from non-credit card ones -- is made. 191 // distinguishing credit card sections from non-credit card ones -- is made.
200 void IdentifySections(bool has_author_specified_sections); 192 void IdentifySections(bool has_author_specified_sections);
201 193
202 bool IsAutocheckoutEnabled() const;
203
204 // Returns true if field should be skipped when talking to Autofill server. 194 // Returns true if field should be skipped when talking to Autofill server.
205 bool ShouldSkipField(const FormFieldData& field) const; 195 bool ShouldSkipField(const FormFieldData& field) const;
206 196
207 // Returns the minimal number of fillable fields required to start autofill.
208 size_t RequiredFillableFields() const;
209 size_t active_field_count() const; 197 size_t active_field_count() const;
210 198
211 // The name of the form. 199 // The name of the form.
212 base::string16 form_name_; 200 base::string16 form_name_;
213 201
214 // The source URL. 202 // The source URL.
215 GURL source_url_; 203 GURL source_url_;
216 204
217 // The target URL. 205 // The target URL.
218 GURL target_url_; 206 GURL target_url_;
(...skipping 21 matching lines...) Expand all
240 // form. 228 // form.
241 std::string server_experiment_id_; 229 std::string server_experiment_id_;
242 230
243 // GET or POST. 231 // GET or POST.
244 RequestMethod method_; 232 RequestMethod method_;
245 233
246 // Whether the form includes any field types explicitly specified by the site 234 // Whether the form includes any field types explicitly specified by the site
247 // author, via the |autocompletetype| attribute. 235 // author, via the |autocompletetype| attribute.
248 bool has_author_specified_types_; 236 bool has_author_specified_types_;
249 237
250 // The URL prefix matched in autocheckout whitelist. An empty string implies
251 // autocheckout is not enabled for this form.
252 std::string autocheckout_url_prefix_;
253
254 // Whether or not this form was filled by Autocheckout.
255 bool filled_by_autocheckout_;
256
257 DISALLOW_COPY_AND_ASSIGN(FormStructure); 238 DISALLOW_COPY_AND_ASSIGN(FormStructure);
258 }; 239 };
259 240
260 } // namespace autofill 241 } // namespace autofill
261 242
262 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_ 243 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FORM_STRUCTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698