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

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

Issue 1874493002: [Autofill] Add user actions for checkout flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 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
OLDNEW
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 #include "components/autofill/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 705
706 if (is_new_popup) { 706 if (is_new_popup) {
707 AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN); 707 AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN);
708 708
709 if (!did_show_suggestions_) { 709 if (!did_show_suggestions_) {
710 did_show_suggestions_ = true; 710 did_show_suggestions_ = true;
711 AutofillMetrics::LogUserHappinessMetric( 711 AutofillMetrics::LogUserHappinessMetric(
712 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); 712 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE);
713 } 713 }
714 714
715 if (autofill_field->Type().group() == CREDIT_CARD) 715 if (autofill_field->Type().group() == CREDIT_CARD) {
716 credit_card_form_event_logger_->OnDidShowSuggestions(); 716 credit_card_form_event_logger_->OnDidShowSuggestions();
717 else 717 } else {
718 address_form_event_logger_->OnDidShowSuggestions(); 718 address_form_event_logger_->OnDidShowSuggestions();
719 }
719 } 720 }
720 } 721 }
721 722
722 void AutofillManager::OnHidePopup() { 723 void AutofillManager::OnHidePopup() {
723 if (!IsAutofillEnabled()) 724 if (!IsAutofillEnabled())
724 return; 725 return;
725 726
726 autocomplete_history_manager_->CancelPendingQuery(); 727 autocomplete_history_manager_->CancelPendingQuery();
727 client_->HideAutofillPopup(); 728 client_->HideAutofillPopup();
728 } 729 }
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 std::vector<FormStructure*> forms(1, *updated_form); 1640 std::vector<FormStructure*> forms(1, *updated_form);
1640 driver_->SendAutofillTypePredictionsToRenderer(forms); 1641 driver_->SendAutofillTypePredictionsToRenderer(forms);
1641 1642
1642 return true; 1643 return true;
1643 } 1644 }
1644 1645
1645 std::vector<Suggestion> AutofillManager::GetProfileSuggestions( 1646 std::vector<Suggestion> AutofillManager::GetProfileSuggestions(
1646 const FormStructure& form, 1647 const FormStructure& form,
1647 const FormFieldData& field, 1648 const FormFieldData& field,
1648 const AutofillField& autofill_field) const { 1649 const AutofillField& autofill_field) const {
1650 address_form_event_logger_->OnDidPollSuggestions();
1651
1649 std::vector<ServerFieldType> field_types(form.field_count()); 1652 std::vector<ServerFieldType> field_types(form.field_count());
1650 for (size_t i = 0; i < form.field_count(); ++i) { 1653 for (size_t i = 0; i < form.field_count(); ++i) {
1651 field_types.push_back(form.field(i)->Type().GetStorableType()); 1654 field_types.push_back(form.field(i)->Type().GetStorableType());
1652 } 1655 }
1653 1656
1654 std::vector<Suggestion> suggestions = personal_data_->GetProfileSuggestions( 1657 std::vector<Suggestion> suggestions = personal_data_->GetProfileSuggestions(
1655 autofill_field.Type(), field.value, field.is_autofilled, field_types); 1658 autofill_field.Type(), field.value, field.is_autofilled, field_types);
1656 1659
1657 // Adjust phone number to display in prefix/suffix case. 1660 // Adjust phone number to display in prefix/suffix case.
1658 if (autofill_field.Type().GetStorableType() == PHONE_HOME_NUMBER) { 1661 if (autofill_field.Type().GetStorableType() == PHONE_HOME_NUMBER) {
1659 for (size_t i = 0; i < suggestions.size(); ++i) { 1662 for (size_t i = 0; i < suggestions.size(); ++i) {
1660 suggestions[i].value = AutofillField::GetPhoneNumberValue( 1663 suggestions[i].value = AutofillField::GetPhoneNumberValue(
1661 autofill_field, suggestions[i].value, field); 1664 autofill_field, suggestions[i].value, field);
1662 } 1665 }
1663 } 1666 }
1664 1667
1665 for (size_t i = 0; i < suggestions.size(); ++i) { 1668 for (size_t i = 0; i < suggestions.size(); ++i) {
1666 suggestions[i].frontend_id = 1669 suggestions[i].frontend_id =
1667 MakeFrontendID(std::string(), suggestions[i].backend_id); 1670 MakeFrontendID(std::string(), suggestions[i].backend_id);
1668 } 1671 }
1669 return suggestions; 1672 return suggestions;
1670 } 1673 }
1671 1674
1672 std::vector<Suggestion> AutofillManager::GetCreditCardSuggestions( 1675 std::vector<Suggestion> AutofillManager::GetCreditCardSuggestions(
1673 const FormFieldData& field, 1676 const FormFieldData& field,
1674 const AutofillType& type) const { 1677 const AutofillType& type) const {
1678 credit_card_form_event_logger_->OnDidPollSuggestions();
1679
1675 // The field value is sanitized before attempting to match it to the user's 1680 // The field value is sanitized before attempting to match it to the user's
1676 // data. 1681 // data.
1677 std::vector<Suggestion> suggestions = 1682 std::vector<Suggestion> suggestions =
1678 personal_data_->GetCreditCardSuggestions( 1683 personal_data_->GetCreditCardSuggestions(
1679 type, SanitizeCreditCardFieldValue(field.value)); 1684 type, SanitizeCreditCardFieldValue(field.value));
1680 for (size_t i = 0; i < suggestions.size(); i++) { 1685 for (size_t i = 0; i < suggestions.size(); i++) {
1681 suggestions[i].frontend_id = 1686 suggestions[i].frontend_id =
1682 MakeFrontendID(suggestions[i].backend_id, std::string()); 1687 MakeFrontendID(suggestions[i].backend_id, std::string());
1683 } 1688 }
1684 return suggestions; 1689 return suggestions;
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 if (i > 0) 2003 if (i > 0)
1999 fputs("Next oldest form:\n", file); 2004 fputs("Next oldest form:\n", file);
2000 } 2005 }
2001 fputs("\n", file); 2006 fputs("\n", file);
2002 2007
2003 fclose(file); 2008 fclose(file);
2004 } 2009 }
2005 #endif // ENABLE_FORM_DEBUG_DUMP 2010 #endif // ENABLE_FORM_DEBUG_DUMP
2006 2011
2007 } // namespace autofill 2012 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | components/autofill/core/browser/autofill_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698