| OLD | NEW |
| 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_AUTOFILL_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 const FormData& form, | 102 const FormData& form, |
| 103 const FormFieldData& field, | 103 const FormFieldData& field, |
| 104 int unique_id); | 104 int unique_id); |
| 105 virtual void FillCreditCardForm(int query_id, | 105 virtual void FillCreditCardForm(int query_id, |
| 106 const FormData& form, | 106 const FormData& form, |
| 107 const FormFieldData& field, | 107 const FormFieldData& field, |
| 108 const CreditCard& credit_card); | 108 const CreditCard& credit_card); |
| 109 void DidShowSuggestions(bool is_new_popup, | 109 void DidShowSuggestions(bool is_new_popup, |
| 110 const FormData& form, | 110 const FormData& form, |
| 111 const FormFieldData& field); | 111 const FormFieldData& field); |
| 112 void OnDidFillAutofillFormData(const base::TimeTicks& timestamp); | 112 void OnFocusNoLongerOnForm(); |
| 113 void OnDidFillAutofillFormData(const FormData& form, |
| 114 const base::TimeTicks& timestamp); |
| 113 void OnDidPreviewAutofillFormData(); | 115 void OnDidPreviewAutofillFormData(); |
| 114 | 116 |
| 115 // Returns true if the value/identifier is deletable. Fills out | 117 // Returns true if the value/identifier is deletable. Fills out |
| 116 // |title| and |body| with relevant user-facing text. | 118 // |title| and |body| with relevant user-facing text. |
| 117 bool GetDeletionConfirmationText(const base::string16& value, | 119 bool GetDeletionConfirmationText(const base::string16& value, |
| 118 int identifier, | 120 int identifier, |
| 119 base::string16* title, | 121 base::string16* title, |
| 120 base::string16* body); | 122 base::string16* body); |
| 121 | 123 |
| 122 // Remove the credit card or Autofill profile that matches |unique_id| | 124 // Remove the credit card or Autofill profile that matches |unique_id| |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // | 161 // |
| 160 // Processes the about-to-be-submitted |form|, uploading the possible field | 162 // Processes the about-to-be-submitted |form|, uploading the possible field |
| 161 // types for the submitted fields to the crowdsourcing server. Returns false | 163 // types for the submitted fields to the crowdsourcing server. Returns false |
| 162 // if this form is not relevant for Autofill. | 164 // if this form is not relevant for Autofill. |
| 163 bool OnWillSubmitForm(const FormData& form, const base::TimeTicks& timestamp); | 165 bool OnWillSubmitForm(const FormData& form, const base::TimeTicks& timestamp); |
| 164 | 166 |
| 165 // Processes the submitted |form|, saving any new Autofill data to the user's | 167 // Processes the submitted |form|, saving any new Autofill data to the user's |
| 166 // personal profile. Returns false if this form is not relevant for Autofill. | 168 // personal profile. Returns false if this form is not relevant for Autofill. |
| 167 bool OnFormSubmitted(const FormData& form); | 169 bool OnFormSubmitted(const FormData& form); |
| 168 | 170 |
| 171 // Will send an upload based on the |form_structure| data and the local |
| 172 // Autofill profile data. |observed_submission| is specified if the upload |
| 173 // follows an observed submission event. |
| 174 void StartUploadProcess(scoped_ptr<FormStructure> form_structure, |
| 175 const base::TimeTicks& timestamp, |
| 176 bool observed_submission); |
| 177 |
| 178 // Update the pending form with |form|, possibly processing the current |
| 179 // pending form for upload. |
| 180 void UpdatePendingForm(const FormData& form); |
| 181 |
| 182 // Upload the current pending form. |
| 183 void ProcessPendingFormForUpload(); |
| 184 |
| 169 void OnTextFieldDidChange(const FormData& form, | 185 void OnTextFieldDidChange(const FormData& form, |
| 170 const FormFieldData& field, | 186 const FormFieldData& field, |
| 171 const base::TimeTicks& timestamp); | 187 const base::TimeTicks& timestamp); |
| 172 | 188 |
| 173 // The |bounding_box| is a window relative value. | 189 // The |bounding_box| is a window relative value. |
| 174 void OnQueryFormFieldAutofill(int query_id, | 190 void OnQueryFormFieldAutofill(int query_id, |
| 175 const FormData& form, | 191 const FormData& form, |
| 176 const FormFieldData& field, | 192 const FormFieldData& field, |
| 177 const gfx::RectF& bounding_box); | 193 const gfx::RectF& bounding_box); |
| 178 void OnDidEndTextFieldEditing(); | 194 void OnDidEndTextFieldEditing(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 198 protected: | 214 protected: |
| 199 // Test code should prefer to use this constructor. | 215 // Test code should prefer to use this constructor. |
| 200 AutofillManager(AutofillDriver* driver, | 216 AutofillManager(AutofillDriver* driver, |
| 201 AutofillClient* client, | 217 AutofillClient* client, |
| 202 PersonalDataManager* personal_data); | 218 PersonalDataManager* personal_data); |
| 203 | 219 |
| 204 // Uploads the form data to the Autofill server. | 220 // Uploads the form data to the Autofill server. |
| 205 virtual void UploadFormData(const FormStructure& submitted_form); | 221 virtual void UploadFormData(const FormStructure& submitted_form); |
| 206 | 222 |
| 207 // Logs quality metrics for the |submitted_form| and uploads the form data | 223 // Logs quality metrics for the |submitted_form| and uploads the form data |
| 208 // to the crowdsourcing server, if appropriate. | 224 // to the crowdsourcing server, if appropriate. |observed_submission| |
| 225 // indicates whether the upload is a result of an observed submission event. |
| 209 virtual void UploadFormDataAsyncCallback( | 226 virtual void UploadFormDataAsyncCallback( |
| 210 const FormStructure* submitted_form, | 227 const FormStructure* submitted_form, |
| 211 const base::TimeTicks& load_time, | 228 const base::TimeTicks& load_time, |
| 212 const base::TimeTicks& interaction_time, | 229 const base::TimeTicks& interaction_time, |
| 213 const base::TimeTicks& submission_time); | 230 const base::TimeTicks& submission_time, |
| 231 bool observed_submission); |
| 214 | 232 |
| 215 // Maps suggestion backend ID to and from an integer identifying it. Two of | 233 // Maps suggestion backend ID to and from an integer identifying it. Two of |
| 216 // these intermediate integers are packed by MakeFrontendID to make the IDs | 234 // these intermediate integers are packed by MakeFrontendID to make the IDs |
| 217 // that this class generates for the UI and for IPC. | 235 // that this class generates for the UI and for IPC. |
| 218 virtual int BackendIDToInt(const std::string& backend_id) const; | 236 virtual int BackendIDToInt(const std::string& backend_id) const; |
| 219 virtual std::string IntToBackendID(int int_id) const; | 237 virtual std::string IntToBackendID(int int_id) const; |
| 220 | 238 |
| 221 // Methods for packing and unpacking credit card and profile IDs for sending | 239 // Methods for packing and unpacking credit card and profile IDs for sending |
| 222 // and receiving to and from the renderer process. | 240 // and receiving to and from the renderer process. |
| 223 int MakeFrontendID(const std::string& cc_backend_id, | 241 int MakeFrontendID(const std::string& cc_backend_id, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 bool user_did_edit_autofilled_field_; | 455 bool user_did_edit_autofilled_field_; |
| 438 // When the form finished loading. | 456 // When the form finished loading. |
| 439 std::map<FormData, base::TimeTicks> forms_loaded_timestamps_; | 457 std::map<FormData, base::TimeTicks> forms_loaded_timestamps_; |
| 440 // When the user first interacted with a potentially fillable form on this | 458 // When the user first interacted with a potentially fillable form on this |
| 441 // page. | 459 // page. |
| 442 base::TimeTicks initial_interaction_timestamp_; | 460 base::TimeTicks initial_interaction_timestamp_; |
| 443 | 461 |
| 444 // Our copy of the form data. | 462 // Our copy of the form data. |
| 445 ScopedVector<FormStructure> form_structures_; | 463 ScopedVector<FormStructure> form_structures_; |
| 446 | 464 |
| 465 // A copy of the currently interacted form data. |
| 466 scoped_ptr<FormData> pending_form_data_; |
| 467 |
| 447 // Collected information about a pending unmask request, and data about the | 468 // Collected information about a pending unmask request, and data about the |
| 448 // form. | 469 // form. |
| 449 payments::PaymentsClient::UnmaskRequestDetails unmask_request_; | 470 payments::PaymentsClient::UnmaskRequestDetails unmask_request_; |
| 450 int unmasking_query_id_; | 471 int unmasking_query_id_; |
| 451 FormData unmasking_form_; | 472 FormData unmasking_form_; |
| 452 FormFieldData unmasking_field_; | 473 FormFieldData unmasking_field_; |
| 453 // Time when we requested the last real pan. | 474 // Time when we requested the last real pan. |
| 454 base::Time real_pan_request_timestamp_; | 475 base::Time real_pan_request_timestamp_; |
| 455 | 476 |
| 456 // Collected information about a pending upload request. | 477 // Collected information about a pending upload request. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 559 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |
| 539 DontSaveCvcInAutocompleteHistory); | 560 DontSaveCvcInAutocompleteHistory); |
| 540 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, DontOfferToSavePaymentsCard); | 561 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, DontOfferToSavePaymentsCard); |
| 541 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, FillInUpdatedExpirationDate); | 562 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, FillInUpdatedExpirationDate); |
| 542 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 563 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
| 543 }; | 564 }; |
| 544 | 565 |
| 545 } // namespace autofill | 566 } // namespace autofill |
| 546 | 567 |
| 547 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ | 568 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ |
| OLD | NEW |