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

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

Issue 15097004: Enable Autocomplete feature for chromium webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setSaveFormData2
Patch Set: added a unit test Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_AUTOFILL_MANAGER_H_ 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_ 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 autofill::AutofillManagerDelegate* delegate, 150 autofill::AutofillManagerDelegate* delegate,
151 const std::string& app_locale, 151 const std::string& app_locale,
152 AutofillDownloadManagerState enable_download_manager); 152 AutofillDownloadManagerState enable_download_manager);
153 virtual ~AutofillManager(); 153 virtual ~AutofillManager();
154 154
155 // Test code should prefer to use this constructor. 155 // Test code should prefer to use this constructor.
156 AutofillManager(content::WebContents* web_contents, 156 AutofillManager(content::WebContents* web_contents,
157 autofill::AutofillManagerDelegate* delegate, 157 autofill::AutofillManagerDelegate* delegate,
158 PersonalDataManager* personal_data); 158 PersonalDataManager* personal_data);
159 159
160 // Returns the value of the AutofillEnabled pref. 160 // Returns the value of the AutofillEnabled pref.
Ilya Sherman 2013/06/15 00:28:09 Please update this comment.
sgurun-gerrit only 2013/06/17 21:20:32 Done.
161 virtual bool IsAutofillEnabled() const; 161 virtual bool IsAutofillEnabled() const;
162 162
163 // Uploads the form data to the Autofill server. 163 // Uploads the form data to the Autofill server.
164 virtual void UploadFormData(const FormStructure& submitted_form); 164 virtual void UploadFormData(const FormStructure& submitted_form);
165 165
166 // Reset cache. 166 // Reset cache.
167 void Reset(); 167 void Reset();
168 168
169 // Logs quality metrics for the |submitted_form| and uploads the form data 169 // Logs quality metrics for the |submitted_form| and uploads the form data
170 // to the crowdsourcing server, if appropriate. 170 // to the crowdsourcing server, if appropriate.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 AutofillExternalDelegate* external_delegate() { 203 AutofillExternalDelegate* external_delegate() {
204 return external_delegate_; 204 return external_delegate_;
205 } 205 }
206 206
207 // Exposed for testing. 207 // Exposed for testing.
208 autofill::AutocheckoutManager* autocheckout_manager() { 208 autofill::AutocheckoutManager* autocheckout_manager() {
209 return &autocheckout_manager_; 209 return &autocheckout_manager_;
210 } 210 }
211 211
212 // Processes the submitted |form|, saving any new Autofill data and uploading 212 // Processes the submitted |form|, saving any new Autofill data and uploading
213 // the possible field types for the submitted fields to the crowdsouring 213 // the possible field types for the submitted fields to the crowdsourcing
214 // server. Returns false if this form is not relevant for Autofill. 214 // server. Returns false if this form is not relevant for Autofill.
215 bool OnFormSubmitted(const FormData& form, 215 bool OnFormSubmitted(const FormData& form,
216 const base::TimeTicks& timestamp); 216 const base::TimeTicks& timestamp);
217 217
218 // Tell the renderer the current interactive autocomplete finished. 218 // Tell the renderer the current interactive autocomplete finished.
219 virtual void ReturnAutocompleteResult( 219 virtual void ReturnAutocompleteResult(
220 WebKit::WebFormElement::AutocompleteResult result, 220 WebKit::WebFormElement::AutocompleteResult result,
221 const FormData& form_data); 221 const FormData& form_data);
222 222
223 private: 223 private:
224 // content::WebContentsObserver: 224 // content::WebContentsObserver:
225 virtual void DidNavigateMainFrame( 225 virtual void DidNavigateMainFrame(
226 const content::LoadCommittedDetails& details, 226 const content::LoadCommittedDetails& details,
227 const content::FrameNavigateParams& params) OVERRIDE; 227 const content::FrameNavigateParams& params) OVERRIDE;
228 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 228 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
229 229
230 // AutofillDownloadManager::Observer: 230 // AutofillDownloadManager::Observer:
231 virtual void OnLoadedServerPredictions( 231 virtual void OnLoadedServerPredictions(
232 const std::string& response_xml) OVERRIDE; 232 const std::string& response_xml) OVERRIDE;
233 233
234 void OnFormsSeen(const std::vector<FormData>& forms, 234 void OnFormsSeen(const std::vector<FormData>& forms,
235 const base::TimeTicks& timestamp, 235 const base::TimeTicks& timestamp,
236 autofill::FormsSeenState state); 236 autofill::FormsSeenState state);
237
237 void OnTextFieldDidChange(const FormData& form, 238 void OnTextFieldDidChange(const FormData& form,
238 const FormFieldData& field, 239 const FormFieldData& field,
239 const base::TimeTicks& timestamp); 240 const base::TimeTicks& timestamp);
240 241
241 // The |bounding_box| is a window relative value. 242 // The |bounding_box| is a window relative value.
242 void OnQueryFormFieldAutofill(int query_id, 243 void OnQueryFormFieldAutofill(int query_id,
243 const FormData& form, 244 const FormData& form,
244 const FormFieldData& field, 245 const FormFieldData& field,
245 const gfx::RectF& bounding_box, 246 const gfx::RectF& bounding_box,
246 bool display_warning); 247 bool display_warning);
248
249 // Receive autofillsuggestions from |personal_data_|.
250 void GetAutofillSuggestions(
251 const FormData& form,
252 const FormFieldData& field,
253 std::vector<base::string16>* values,
254 std::vector<base::string16>* labels,
255 std::vector<string16>* icons,
256 std::vector<int>* unique_ids);
257
247 void OnDidEndTextFieldEditing(); 258 void OnDidEndTextFieldEditing();
248 void OnHideAutofillUi(); 259 void OnHideAutofillUi();
249 void OnAddPasswordFormMapping( 260 void OnAddPasswordFormMapping(
250 const FormFieldData& form, 261 const FormFieldData& form,
251 const PasswordFormFillData& fill_data); 262 const PasswordFormFillData& fill_data);
252 void OnShowPasswordSuggestions( 263 void OnShowPasswordSuggestions(
253 const FormFieldData& field, 264 const FormFieldData& field,
254 const gfx::RectF& bounds, 265 const gfx::RectF& bounds,
255 const std::vector<base::string16>& suggestions); 266 const std::vector<base::string16>& suggestions);
256 void OnSetDataList(const std::vector<base::string16>& values, 267 void OnSetDataList(const std::vector<base::string16>& values,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 void SendAutofillTypePredictions( 354 void SendAutofillTypePredictions(
344 const std::vector<FormStructure*>& forms) const; 355 const std::vector<FormStructure*>& forms) const;
345 356
346 autofill::AutofillManagerDelegate* const manager_delegate_; 357 autofill::AutofillManagerDelegate* const manager_delegate_;
347 358
348 std::string app_locale_; 359 std::string app_locale_;
349 360
350 // The personal data manager, used to save and load personal data to/from the 361 // The personal data manager, used to save and load personal data to/from the
351 // web database. This is overridden by the AutofillManagerTest. 362 // web database. This is overridden by the AutofillManagerTest.
352 // Weak reference. 363 // Weak reference.
353 // May be NULL. NULL indicates OTR. 364 // May be NULL for OTR and Android Webview.
Ilya Sherman 2013/06/15 00:28:09 I don't think it's true that personal_data_ is nul
sgurun-gerrit only 2013/06/17 21:20:32 himm, perhaps the comment is not true anymore then
354 PersonalDataManager* personal_data_; 365 PersonalDataManager* personal_data_;
355 366
356 std::list<std::string> autofilled_form_signatures_; 367 std::list<std::string> autofilled_form_signatures_;
357 368
358 // Handles queries and uploads to Autofill servers. Will be NULL if 369 // Handles queries and uploads to Autofill servers. Will be NULL if
359 // the download manager functionality is disabled. 370 // the download manager functionality is disabled.
360 scoped_ptr<AutofillDownloadManager> download_manager_; 371 scoped_ptr<AutofillDownloadManager> download_manager_;
361 372
362 // Handles single-field autocomplete form data. 373 // Handles single-field autocomplete form data.
363 AutocompleteHistoryManager autocomplete_history_manager_; 374 AutocompleteHistoryManager autocomplete_history_manager_;
364 375
365 // Handles autocheckout flows. 376 // Handles autocheckout flows. NULL for Android Webview.
Ilya Sherman 2013/06/15 00:28:09 What does it mean for this non-pointer value to be
sgurun-gerrit only 2013/06/17 21:20:32 yeah. this is a runaway leftover comment. I was th
366 autofill::AutocheckoutManager autocheckout_manager_; 377 autofill::AutocheckoutManager autocheckout_manager_;
367 378
368 // For logging UMA metrics. Overridden by metrics tests. 379 // For logging UMA metrics. Overridden by metrics tests.
369 scoped_ptr<const AutofillMetrics> metric_logger_; 380 scoped_ptr<const AutofillMetrics> metric_logger_;
370 // Have we logged whether Autofill is enabled for this page load? 381 // Have we logged whether Autofill is enabled for this page load?
371 bool has_logged_autofill_enabled_; 382 bool has_logged_autofill_enabled_;
372 // Have we logged an address suggestions count metric for this page? 383 // Have we logged an address suggestions count metric for this page?
373 bool has_logged_address_suggestions_count_; 384 bool has_logged_address_suggestions_count_;
374 // Have we shown Autofill suggestions at least once? 385 // Have we shown Autofill suggestions at least once?
375 bool did_show_suggestions_; 386 bool did_show_suggestions_;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, 437 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
427 UserHappinessFormLoadAndSubmission); 438 UserHappinessFormLoadAndSubmission);
428 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); 439 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction);
429 440
430 DISALLOW_COPY_AND_ASSIGN(AutofillManager); 441 DISALLOW_COPY_AND_ASSIGN(AutofillManager);
431 }; 442 };
432 443
433 } // namespace autofill 444 } // namespace autofill
434 445
435 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_ 446 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698