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

Side by Side Diff: chrome/browser/autofill/autofill_manager.h

Issue 3157025: Merge 56435 - AutoFillManagerTest.GetProfileSuggestionsEmptyValue crashes in ... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 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
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include <vector> 8 #include <vector>
9 #include <string> 9 #include <string>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void HandleSubmit(); 83 void HandleSubmit();
84 84
85 // Uploads the form data to the AutoFill server. 85 // Uploads the form data to the AutoFill server.
86 void UploadFormData(); 86 void UploadFormData();
87 87
88 protected: 88 protected:
89 // For tests. 89 // For tests.
90 AutoFillManager(); 90 AutoFillManager();
91 AutoFillManager(TabContents* tab_contents, 91 AutoFillManager(TabContents* tab_contents,
92 PersonalDataManager* personal_data); 92 PersonalDataManager* personal_data);
93
93 void set_personal_data_manager(PersonalDataManager* personal_data) { 94 void set_personal_data_manager(PersonalDataManager* personal_data) {
94 personal_data_ = personal_data; 95 personal_data_ = personal_data;
95 } 96 }
96 97
97 private: 98 private:
98 // Returns a list of values from the stored profiles that match |type| and the 99 // Returns a list of values from the stored profiles that match |type| and the
99 // value of |field| and returns the labels of the matching profiles. |labels| 100 // value of |field| and returns the labels of the matching profiles. |labels|
100 // is filled with the Profile label and possibly the last four digits of a 101 // is filled with the Profile label and possibly the last four digits of a
101 // corresponding credit card: 'Home; *1258' - Home is the Profile label and 102 // corresponding credit card: 'Home; *1258' - Home is the Profile label and
102 // 1258 is the last four digits of the credit card. If |include_cc_labels| is 103 // 1258 is the last four digits of the credit card. If |include_cc_labels| is
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 webkit_glue::FormField* field); 164 webkit_glue::FormField* field);
164 165
165 // Parses the forms using heuristic matching and querying the AutoFill server. 166 // Parses the forms using heuristic matching and querying the AutoFill server.
166 void ParseForms(const std::vector<webkit_glue::FormData>& forms); 167 void ParseForms(const std::vector<webkit_glue::FormData>& forms);
167 168
168 // Methods for packing and unpacking credit card and profile IDs for sending 169 // Methods for packing and unpacking credit card and profile IDs for sending
169 // and receiving to and from the renderer process. 170 // and receiving to and from the renderer process.
170 static int PackIDs(int cc_id, int profile_id); 171 static int PackIDs(int cc_id, int profile_id);
171 static void UnpackIDs(int id, int* cc_id, int* profile_id); 172 static void UnpackIDs(int id, int* cc_id, int* profile_id);
172 173
174 // The following function is meant to be called from unit-test only.
175 void set_disable_download_manager_requests(bool value) {
176 disable_download_manager_requests_ = value;
177 }
178
173 // The TabContents hosting this AutoFillManager. 179 // The TabContents hosting this AutoFillManager.
174 // Weak reference. 180 // Weak reference.
175 // May not be NULL. 181 // May not be NULL.
176 TabContents* tab_contents_; 182 TabContents* tab_contents_;
177 183
178 // The personal data manager, used to save and load personal data to/from the 184 // The personal data manager, used to save and load personal data to/from the
179 // web database. This is overridden by the AutoFillManagerTest. 185 // web database. This is overridden by the AutoFillManagerTest.
180 // Weak reference. 186 // Weak reference.
181 // May be NULL. NULL indicates OTR. 187 // May be NULL. NULL indicates OTR.
182 PersonalDataManager* personal_data_; 188 PersonalDataManager* personal_data_;
183 189
184 // Handles queries and uploads to AutoFill servers. 190 // Handles queries and uploads to AutoFill servers.
185 AutoFillDownloadManager download_manager_; 191 AutoFillDownloadManager download_manager_;
186 192
193 // Should be set to true in AutoFillManagerTest and other tests, false in
194 // AutoFillDownloadManagerTest and in non-test environment. Is false by
195 // default.
196 bool disable_download_manager_requests_;
197
187 // Our copy of the form data. 198 // Our copy of the form data.
188 ScopedVector<FormStructure> form_structures_; 199 ScopedVector<FormStructure> form_structures_;
189 200
190 // The form data the user has submitted. 201 // The form data the user has submitted.
191 scoped_ptr<FormStructure> upload_form_structure_; 202 scoped_ptr<FormStructure> upload_form_structure_;
192 203
193 // The InfoBar that asks for permission to store credit card information. 204 // The InfoBar that asks for permission to store credit card information.
194 scoped_ptr<AutoFillCCInfoBarDelegate> cc_infobar_; 205 scoped_ptr<AutoFillCCInfoBarDelegate> cc_infobar_;
195 206
196 friend class AutoFillManagerTest; 207 friend class TestAutoFillManager;
197 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillCreditCardForm); 208 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillCreditCardForm);
198 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillNonBillingFormSemicolon); 209 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillNonBillingFormSemicolon);
199 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillBillFormSemicolon); 210 FRIEND_TEST_ALL_PREFIXES(AutoFillManagerTest, FillBillFormSemicolon);
200 211
201 DISALLOW_COPY_AND_ASSIGN(AutoFillManager); 212 DISALLOW_COPY_AND_ASSIGN(AutoFillManager);
202 }; 213 };
203 214
204 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ 215 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698