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

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

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

Powered by Google App Engine
This is Rietveld 408576698