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 "components/autofill/browser/autofill_manager.h" | 5 #include "components/autofill/browser/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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 } | 761 } |
762 | 762 |
763 const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { | 763 const std::vector<FormStructure*>& AutofillManager::GetFormStructures() { |
764 return form_structures_.get(); | 764 return form_structures_.get(); |
765 } | 765 } |
766 | 766 |
767 void AutofillManager::ShowRequestAutocompleteDialog( | 767 void AutofillManager::ShowRequestAutocompleteDialog( |
768 const FormData& form, | 768 const FormData& form, |
769 const GURL& source_url, | 769 const GURL& source_url, |
770 autofill::DialogType dialog_type, | 770 autofill::DialogType dialog_type, |
771 const base::Callback<void(const FormStructure*)>& callback) { | 771 const base::Callback<void(const FormStructure*, |
772 const std::string&)>& callback) { | |
772 manager_delegate_->ShowRequestAutocompleteDialog( | 773 manager_delegate_->ShowRequestAutocompleteDialog( |
773 form, source_url, *metric_logger_, dialog_type, callback); | 774 form, source_url, *metric_logger_, dialog_type, callback); |
774 } | 775 } |
775 | 776 |
776 void AutofillManager::RequestAutocompleteDialogClosed() { | 777 void AutofillManager::RequestAutocompleteDialogClosed() { |
777 manager_delegate_->RequestAutocompleteDialogClosed(); | 778 manager_delegate_->RequestAutocompleteDialogClosed(); |
778 } | 779 } |
779 | 780 |
780 void AutofillManager::SetTestDelegate( | 781 void AutofillManager::SetTestDelegate( |
781 autofill::AutofillManagerTestDelegate* delegate) { | 782 autofill::AutofillManagerTestDelegate* delegate) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
816 | 817 |
817 void AutofillManager::OnRequestAutocomplete( | 818 void AutofillManager::OnRequestAutocomplete( |
818 const FormData& form, | 819 const FormData& form, |
819 const GURL& frame_url) { | 820 const GURL& frame_url) { |
820 if (!IsAutofillEnabled()) { | 821 if (!IsAutofillEnabled()) { |
821 ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorDisabled, | 822 ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorDisabled, |
822 FormData()); | 823 FormData()); |
823 return; | 824 return; |
824 } | 825 } |
825 | 826 |
826 base::Callback<void(const FormStructure*)> callback = | 827 base::Callback<void(const FormStructure*, const std::string&)> callback = |
827 base::Bind(&AutofillManager::ReturnAutocompleteData, | 828 base::Bind(&AutofillManager::ReturnAutocompleteData, |
828 weak_ptr_factory_.GetWeakPtr()); | 829 weak_ptr_factory_.GetWeakPtr()); |
829 ShowRequestAutocompleteDialog( | 830 ShowRequestAutocompleteDialog( |
830 form, frame_url, autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE, callback); | 831 form, frame_url, autofill::DIALOG_TYPE_REQUEST_AUTOCOMPLETE, callback); |
831 } | 832 } |
832 | 833 |
833 void AutofillManager::ReturnAutocompleteResult( | 834 void AutofillManager::ReturnAutocompleteResult( |
834 WebFormElement::AutocompleteResult result, const FormData& form_data) { | 835 WebFormElement::AutocompleteResult result, const FormData& form_data) { |
835 // web_contents() will be NULL when the interactive autocomplete is closed due | 836 // web_contents() will be NULL when the interactive autocomplete is closed due |
836 // to a tab or browser window closing. | 837 // to a tab or browser window closing. |
837 if (!web_contents()) | 838 if (!web_contents()) |
838 return; | 839 return; |
839 | 840 |
840 RenderViewHost* host = web_contents()->GetRenderViewHost(); | 841 RenderViewHost* host = web_contents()->GetRenderViewHost(); |
841 if (!host) | 842 if (!host) |
842 return; | 843 return; |
843 | 844 |
844 host->Send(new AutofillMsg_RequestAutocompleteResult(host->GetRoutingID(), | 845 host->Send(new AutofillMsg_RequestAutocompleteResult(host->GetRoutingID(), |
845 result, | 846 result, |
846 form_data)); | 847 form_data)); |
847 } | 848 } |
848 | 849 |
849 void AutofillManager::ReturnAutocompleteData(const FormStructure* result) { | 850 void AutofillManager::ReturnAutocompleteData(const FormStructure* result, |
851 const std::string& not_used) { | |
Ilya Sherman
2013/03/26 23:50:01
nit: "not_used" -> "unused_transaction_id"
ahutter
2013/03/27 01:23:33
Done.
| |
850 RequestAutocompleteDialogClosed(); | 852 RequestAutocompleteDialogClosed(); |
851 if (!result) { | 853 if (!result) { |
852 ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorCancel, | 854 ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorCancel, |
853 FormData()); | 855 FormData()); |
854 } else { | 856 } else { |
855 ReturnAutocompleteResult(WebFormElement::AutocompleteResultSuccess, | 857 ReturnAutocompleteResult(WebFormElement::AutocompleteResultSuccess, |
856 result->ToFormData()); | 858 result->ToFormData()); |
857 } | 859 } |
858 } | 860 } |
859 | 861 |
(...skipping 13 matching lines...) Expand all Loading... | |
873 // If the corresponding flag is set, annotate forms with the predicted types. | 875 // If the corresponding flag is set, annotate forms with the predicted types. |
874 SendAutofillTypePredictions(form_structures_.get()); | 876 SendAutofillTypePredictions(form_structures_.get()); |
875 } | 877 } |
876 | 878 |
877 void AutofillManager::OnDidEndTextFieldEditing() { | 879 void AutofillManager::OnDidEndTextFieldEditing() { |
878 if (external_delegate_) | 880 if (external_delegate_) |
879 external_delegate_->DidEndTextFieldEditing(); | 881 external_delegate_->DidEndTextFieldEditing(); |
880 } | 882 } |
881 | 883 |
882 void AutofillManager::OnClickFailed(autofill::AutocheckoutStatus status) { | 884 void AutofillManager::OnClickFailed(autofill::AutocheckoutStatus status) { |
883 // TODO(ahutter): Plug into WalletClient. | 885 autocheckout_manager_.OnClickFailed(status); |
884 } | 886 } |
885 | 887 |
886 void AutofillManager::OnMaybeShowAutocheckoutBubble( | 888 void AutofillManager::OnMaybeShowAutocheckoutBubble( |
887 const GURL& source_url, | 889 const GURL& source_url, |
888 const content::SSLStatus& ssl_status, | 890 const content::SSLStatus& ssl_status, |
889 const gfx::RectF& bounding_box) { | 891 const gfx::RectF& bounding_box) { |
890 if (!IsAutofillEnabled()) | 892 if (!IsAutofillEnabled()) |
891 return; | 893 return; |
892 | 894 |
893 autocheckout_manager_.MaybeShowAutocheckoutBubble( | 895 autocheckout_manager_.MaybeShowAutocheckoutBubble( |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1330 *profile_guid = IDToGUID(profile_id); | 1332 *profile_guid = IDToGUID(profile_id); |
1331 } | 1333 } |
1332 | 1334 |
1333 void AutofillManager::UpdateInitialInteractionTimestamp( | 1335 void AutofillManager::UpdateInitialInteractionTimestamp( |
1334 const TimeTicks& interaction_timestamp) { | 1336 const TimeTicks& interaction_timestamp) { |
1335 if (initial_interaction_timestamp_.is_null() || | 1337 if (initial_interaction_timestamp_.is_null() || |
1336 interaction_timestamp < initial_interaction_timestamp_) { | 1338 interaction_timestamp < initial_interaction_timestamp_) { |
1337 initial_interaction_timestamp_ = interaction_timestamp; | 1339 initial_interaction_timestamp_ = interaction_timestamp; |
1338 } | 1340 } |
1339 } | 1341 } |
OLD | NEW |