OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 virtual void OnLoadedAutoFillHeuristics(const std::string& heuristic_xml); | 60 virtual void OnLoadedAutoFillHeuristics(const std::string& heuristic_xml); |
61 virtual void OnUploadedAutoFillHeuristics(const std::string& form_signature); | 61 virtual void OnUploadedAutoFillHeuristics(const std::string& form_signature); |
62 virtual void OnHeuristicsRequestError( | 62 virtual void OnHeuristicsRequestError( |
63 const std::string& form_signature, | 63 const std::string& form_signature, |
64 AutoFillDownloadManager::AutoFillRequestType request_type, | 64 AutoFillDownloadManager::AutoFillRequestType request_type, |
65 int http_error); | 65 int http_error); |
66 | 66 |
67 // Returns the value of the AutoFillEnabled pref. | 67 // Returns the value of the AutoFillEnabled pref. |
68 virtual bool IsAutoFillEnabled() const; | 68 virtual bool IsAutoFillEnabled() const; |
69 | 69 |
70 // Handles the form data submitted by the user. | 70 // Handles the form data submitted by the user. |data_present| indicates |
71 void HandleSubmit(); | 71 // bitfield of the fields that we autofilled. |
Ilya Sherman
2011/01/13 23:44:37
Looks to me like |data_present| indicates fields t
GeorgeY
2011/01/18 21:04:56
I think it does. It would mean that UNKNOWN fields
| |
72 void HandleSubmit(std::string const& data_present); | |
72 | 73 |
73 // Uploads the form data to the AutoFill server. | 74 // Uploads the form data to the AutoFill server. |
74 void UploadFormData(); | 75 void UploadFormData(std::string const& data_present); |
75 | 76 |
76 // Reset cache. | 77 // Reset cache. |
77 void Reset(); | 78 void Reset(); |
78 | 79 |
80 // Set |field_type| presence bit in the |bitfield|. | |
81 void SetPresenceBit(AutoFillFieldType field_type, | |
82 std::vector<uint8>* bitfield); | |
83 // Converts |bitfield| to string for uploading. | |
84 std::string ConvertPresenceBitsToString(std::vector<uint8> const& bitfield); | |
Ilya Sherman
2011/01/13 23:44:37
nit: I think these should live in autofill_downloa
GeorgeY
2011/01/18 21:04:56
np. done.
| |
85 | |
79 protected: | 86 protected: |
80 // For tests. | 87 // For tests. |
81 AutoFillManager(); | 88 AutoFillManager(); |
82 AutoFillManager(TabContents* tab_contents, | 89 AutoFillManager(TabContents* tab_contents, |
83 PersonalDataManager* personal_data); | 90 PersonalDataManager* personal_data); |
84 | 91 |
85 void set_personal_data_manager(PersonalDataManager* personal_data) { | 92 void set_personal_data_manager(PersonalDataManager* personal_data) { |
86 personal_data_ = personal_data; | 93 personal_data_ = personal_data; |
87 } | 94 } |
88 | 95 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 | 173 |
167 // Set |field| argument's value for phone number based on contents of the | 174 // Set |field| argument's value for phone number based on contents of the |
168 // |profile|. | 175 // |profile|. |
169 void FillPhoneNumberField(const AutoFillProfile* profile, | 176 void FillPhoneNumberField(const AutoFillProfile* profile, |
170 webkit_glue::FormField* field); | 177 webkit_glue::FormField* field); |
171 | 178 |
172 // Parses the forms using heuristic matching and querying the AutoFill server. | 179 // Parses the forms using heuristic matching and querying the AutoFill server. |
173 void ParseForms(const std::vector<webkit_glue::FormData>& forms); | 180 void ParseForms(const std::vector<webkit_glue::FormData>& forms); |
174 | 181 |
175 // Uses existing personal data to determine possible field types for the | 182 // Uses existing personal data to determine possible field types for the |
176 // |upload_form_structure_|. | 183 // |upload_form_structure_|. Returns string representation of the bitfield of |
177 void DeterminePossibleFieldTypesForUpload( | 184 // all of the fields types that we will send information for the form. |
185 std::string DeterminePossibleFieldTypesForUpload( | |
178 const FormStructure* cached_upload_form_structure); | 186 const FormStructure* cached_upload_form_structure); |
179 | 187 |
180 // The TabContents hosting this AutoFillManager. | 188 // The TabContents hosting this AutoFillManager. |
181 // Weak reference. | 189 // Weak reference. |
182 // May not be NULL. | 190 // May not be NULL. |
183 TabContents* tab_contents_; | 191 TabContents* tab_contents_; |
184 | 192 |
185 // The personal data manager, used to save and load personal data to/from the | 193 // The personal data manager, used to save and load personal data to/from the |
186 // web database. This is overridden by the AutoFillManagerTest. | 194 // web database. This is overridden by the AutoFillManagerTest. |
187 // Weak reference. | 195 // Weak reference. |
(...skipping 16 matching lines...) Expand all Loading... | |
204 // Our copy of the form data. | 212 // Our copy of the form data. |
205 ScopedVector<FormStructure> form_structures_; | 213 ScopedVector<FormStructure> form_structures_; |
206 | 214 |
207 // The form data the user has submitted. | 215 // The form data the user has submitted. |
208 scoped_ptr<FormStructure> upload_form_structure_; | 216 scoped_ptr<FormStructure> upload_form_structure_; |
209 | 217 |
210 // The InfoBar that asks for permission to store credit card information. | 218 // The InfoBar that asks for permission to store credit card information. |
211 // Deletes itself when closed. | 219 // Deletes itself when closed. |
212 AutoFillCCInfoBarDelegate* cc_infobar_; | 220 AutoFillCCInfoBarDelegate* cc_infobar_; |
213 | 221 |
222 // Bitfield that indicates which fields were autofilled for last Credit Card. | |
223 std::string data_autofilled_; | |
224 | |
214 // GUID to ID mapping. We keep two maps to convert back and forth. | 225 // GUID to ID mapping. We keep two maps to convert back and forth. |
215 std::map<std::string, int> guid_id_map_; | 226 std::map<std::string, int> guid_id_map_; |
216 std::map<int, std::string> id_guid_map_; | 227 std::map<int, std::string> id_guid_map_; |
217 | 228 |
218 friend class AutoFillManagerTest; | 229 friend class AutoFillManagerTest; |
219 friend class FormStructureBrowserTest; | 230 friend class FormStructureBrowserTest; |
220 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillCreditCardForm); | 231 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillCreditCardForm); |
221 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillAddressForm); | 232 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillAddressForm); |
222 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillAddressAndCreditCardForm); | 233 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillAddressAndCreditCardForm); |
223 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillAutoFilledForm); | 234 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillAutoFilledForm); |
224 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillPhoneNumber); | 235 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillPhoneNumber); |
225 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FormChangesRemoveField); | 236 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FormChangesRemoveField); |
226 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FormChangesAddField); | 237 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FormChangesAddField); |
227 FRIEND_TEST_ALL_PREFIXES(AutoFillMetricsTest, QualityMetrics); | 238 FRIEND_TEST_ALL_PREFIXES(AutoFillMetricsTest, QualityMetrics); |
228 FRIEND_TEST_ALL_PREFIXES(AutoFillMetricsTest, | 239 FRIEND_TEST_ALL_PREFIXES(AutoFillMetricsTest, |
229 NoQualityMetricsForNonAutoFillableForms); | 240 NoQualityMetricsForNonAutoFillableForms); |
230 FRIEND_TEST_ALL_PREFIXES(AutoFillMetricsTest, QualityMetricsForFailure); | 241 FRIEND_TEST_ALL_PREFIXES(AutoFillMetricsTest, QualityMetricsForFailure); |
231 | 242 |
232 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); | 243 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); |
233 }; | 244 }; |
234 | 245 |
235 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ | 246 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ |
OLD | NEW |