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

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

Issue 12457033: Implements SendAutocheckoutStatus API calls for stats tracking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK Created 7 years, 8 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) 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
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
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(
851 const FormStructure* result,
852 const std::string& unused_transaction_id) {
850 RequestAutocompleteDialogClosed(); 853 RequestAutocompleteDialogClosed();
851 if (!result) { 854 if (!result) {
852 ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorCancel, 855 ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorCancel,
853 FormData()); 856 FormData());
854 } else { 857 } else {
855 ReturnAutocompleteResult(WebFormElement::AutocompleteResultSuccess, 858 ReturnAutocompleteResult(WebFormElement::AutocompleteResultSuccess,
856 result->ToFormData()); 859 result->ToFormData());
857 } 860 }
858 } 861 }
859 862
(...skipping 13 matching lines...) Expand all
873 // If the corresponding flag is set, annotate forms with the predicted types. 876 // If the corresponding flag is set, annotate forms with the predicted types.
874 SendAutofillTypePredictions(form_structures_.get()); 877 SendAutofillTypePredictions(form_structures_.get());
875 } 878 }
876 879
877 void AutofillManager::OnDidEndTextFieldEditing() { 880 void AutofillManager::OnDidEndTextFieldEditing() {
878 if (external_delegate_) 881 if (external_delegate_)
879 external_delegate_->DidEndTextFieldEditing(); 882 external_delegate_->DidEndTextFieldEditing();
880 } 883 }
881 884
882 void AutofillManager::OnClickFailed(autofill::AutocheckoutStatus status) { 885 void AutofillManager::OnClickFailed(autofill::AutocheckoutStatus status) {
883 // TODO(ahutter): Plug into WalletClient. 886 autocheckout_manager_.OnClickFailed(status);
884 } 887 }
885 888
886 void AutofillManager::OnMaybeShowAutocheckoutBubble( 889 void AutofillManager::OnMaybeShowAutocheckoutBubble(
887 const GURL& source_url, 890 const GURL& source_url,
888 const content::SSLStatus& ssl_status, 891 const content::SSLStatus& ssl_status,
889 const gfx::RectF& bounding_box) { 892 const gfx::RectF& bounding_box) {
890 if (!IsAutofillEnabled()) 893 if (!IsAutofillEnabled())
891 return; 894 return;
892 895
893 autocheckout_manager_.MaybeShowAutocheckoutBubble( 896 autocheckout_manager_.MaybeShowAutocheckoutBubble(
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 *profile_guid = IDToGUID(profile_id); 1333 *profile_guid = IDToGUID(profile_id);
1331 } 1334 }
1332 1335
1333 void AutofillManager::UpdateInitialInteractionTimestamp( 1336 void AutofillManager::UpdateInitialInteractionTimestamp(
1334 const TimeTicks& interaction_timestamp) { 1337 const TimeTicks& interaction_timestamp) {
1335 if (initial_interaction_timestamp_.is_null() || 1338 if (initial_interaction_timestamp_.is_null() ||
1336 interaction_timestamp < initial_interaction_timestamp_) { 1339 interaction_timestamp < initial_interaction_timestamp_) {
1337 initial_interaction_timestamp_ = interaction_timestamp; 1340 initial_interaction_timestamp_ = interaction_timestamp;
1338 } 1341 }
1339 } 1342 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698