OLD | NEW |
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 #include "chrome/browser/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 metric_logger_->LogAddressSuggestionsCount(values.size()); | 575 metric_logger_->LogAddressSuggestionsCount(values.size()); |
576 has_logged_address_suggestions_count_ = true; | 576 has_logged_address_suggestions_count_ = true; |
577 } | 577 } |
578 } | 578 } |
579 } | 579 } |
580 | 580 |
581 // If form is known to be at the start of the autofillable flow (i.e, when | 581 // If form is known to be at the start of the autofillable flow (i.e, when |
582 // Autofill server said so), then trigger payments UI while also returning | 582 // Autofill server said so), then trigger payments UI while also returning |
583 // standard autofill suggestions to renderer process. | 583 // standard autofill suggestions to renderer process. |
584 if (page_meta_data_.IsStartOfAutofillableFlow()) { | 584 if (page_meta_data_.IsStartOfAutofillableFlow()) { |
585 AutocheckoutInfoBarDelegate::Create( | 585 autofill::AutocheckoutInfoBarDelegate::Create( |
586 *metric_logger_, | 586 *metric_logger_, |
587 form.origin, | 587 form.origin, |
588 form.ssl_status, | 588 form.ssl_status, |
589 &autocheckout_manager_, | 589 &autocheckout_manager_, |
590 manager_delegate_->GetInfoBarService()); | 590 manager_delegate_->GetInfoBarService()); |
591 } | 591 } |
592 } | 592 } |
593 | 593 |
594 // Add the results from AutoComplete. They come back asynchronously, so we | 594 // Add the results from AutoComplete. They come back asynchronously, so we |
595 // hand off what we generated and they will send the results back to the | 595 // hand off what we generated and they will send the results back to the |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 } | 788 } |
789 | 789 |
790 const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { | 790 const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { |
791 return form_structures_.get(); | 791 return form_structures_.get(); |
792 } | 792 } |
793 | 793 |
794 void AutofillManager::ShowRequestAutocompleteDialog( | 794 void AutofillManager::ShowRequestAutocompleteDialog( |
795 const FormData& form, | 795 const FormData& form, |
796 const GURL& source_url, | 796 const GURL& source_url, |
797 const content::SSLStatus& ssl_status, | 797 const content::SSLStatus& ssl_status, |
| 798 autofill::DialogRequester requester, |
798 const base::Callback<void(const FormStructure*)>& callback) { | 799 const base::Callback<void(const FormStructure*)>& callback) { |
799 manager_delegate_->ShowRequestAutocompleteDialog( | 800 manager_delegate_->ShowRequestAutocompleteDialog( |
800 form, source_url, ssl_status, callback); | 801 form, source_url, ssl_status, *metric_logger_, requester, callback); |
801 } | 802 } |
802 | 803 |
803 void AutofillManager::RequestAutocompleteDialogClosed() { | 804 void AutofillManager::RequestAutocompleteDialogClosed() { |
804 manager_delegate_->RequestAutocompleteDialogClosed(); | 805 manager_delegate_->RequestAutocompleteDialogClosed(); |
805 } | 806 } |
806 | 807 |
807 void AutofillManager::OnAddPasswordFormMapping( | 808 void AutofillManager::OnAddPasswordFormMapping( |
808 const FormFieldData& form, | 809 const FormFieldData& form, |
809 const PasswordFormFillData& fill_data) { | 810 const PasswordFormFillData& fill_data) { |
810 if (external_delegate_) | 811 if (external_delegate_) |
(...skipping 30 matching lines...) Expand all Loading... |
841 const GURL& frame_url, | 842 const GURL& frame_url, |
842 const content::SSLStatus& ssl_status) { | 843 const content::SSLStatus& ssl_status) { |
843 if (!IsAutofillEnabled()) { | 844 if (!IsAutofillEnabled()) { |
844 ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorDisabled, | 845 ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorDisabled, |
845 FormData()); | 846 FormData()); |
846 return; | 847 return; |
847 } | 848 } |
848 | 849 |
849 base::Callback<void(const FormStructure*)> callback = | 850 base::Callback<void(const FormStructure*)> callback = |
850 base::Bind(&AutofillManager::ReturnAutocompleteData, this); | 851 base::Bind(&AutofillManager::ReturnAutocompleteData, this); |
851 ShowRequestAutocompleteDialog(form, frame_url, ssl_status, callback); | 852 ShowRequestAutocompleteDialog( |
| 853 form, frame_url, ssl_status, |
| 854 autofill::DIALOG_REQUESTER_REQUEST_AUTOCOMPLETE, callback); |
852 } | 855 } |
853 | 856 |
854 void AutofillManager::ReturnAutocompleteResult( | 857 void AutofillManager::ReturnAutocompleteResult( |
855 WebFormElement::AutocompleteResult result, const FormData& form_data) { | 858 WebFormElement::AutocompleteResult result, const FormData& form_data) { |
856 // web_contents() will be NULL when the interactive autocomplete is closed due | 859 // web_contents() will be NULL when the interactive autocomplete is closed due |
857 // to a tab or browser window closing. | 860 // to a tab or browser window closing. |
858 if (!web_contents()) | 861 if (!web_contents()) |
859 return; | 862 return; |
860 | 863 |
861 RenderViewHost* host = web_contents()->GetRenderViewHost(); | 864 RenderViewHost* host = web_contents()->GetRenderViewHost(); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 *profile_guid = IDToGUID(profile_id); | 1318 *profile_guid = IDToGUID(profile_id); |
1316 } | 1319 } |
1317 | 1320 |
1318 void AutofillManager::UpdateInitialInteractionTimestamp( | 1321 void AutofillManager::UpdateInitialInteractionTimestamp( |
1319 const TimeTicks& interaction_timestamp) { | 1322 const TimeTicks& interaction_timestamp) { |
1320 if (initial_interaction_timestamp_.is_null() || | 1323 if (initial_interaction_timestamp_.is_null() || |
1321 interaction_timestamp < initial_interaction_timestamp_) { | 1324 interaction_timestamp < initial_interaction_timestamp_) { |
1322 initial_interaction_timestamp_ = interaction_timestamp; | 1325 initial_interaction_timestamp_ = interaction_timestamp; |
1323 } | 1326 } |
1324 } | 1327 } |
OLD | NEW |