Chromium Code Reviews| 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 #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 1989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2000 // static | 2000 // static |
| 2001 void AutofillManager::DeterminePossibleFieldTypesForUpload( | 2001 void AutofillManager::DeterminePossibleFieldTypesForUpload( |
| 2002 const std::vector<AutofillProfile>& profiles, | 2002 const std::vector<AutofillProfile>& profiles, |
| 2003 const std::vector<CreditCard>& credit_cards, | 2003 const std::vector<CreditCard>& credit_cards, |
| 2004 const std::string& app_locale, | 2004 const std::string& app_locale, |
| 2005 FormStructure* submitted_form) { | 2005 FormStructure* submitted_form) { |
| 2006 // For each field in the |submitted_form|, extract the value. Then for each | 2006 // For each field in the |submitted_form|, extract the value. Then for each |
| 2007 // profile or credit card, identify any stored types that match the value. | 2007 // profile or credit card, identify any stored types that match the value. |
| 2008 for (size_t i = 0; i < submitted_form->field_count(); ++i) { | 2008 for (size_t i = 0; i < submitted_form->field_count(); ++i) { |
| 2009 AutofillField* field = submitted_form->field(i); | 2009 AutofillField* field = submitted_form->field(i); |
| 2010 ServerFieldTypeSet matching_types; | 2010 ServerFieldTypeSet matching_types = field->possible_types(); |
|
Roger McFarlane (Chromium)
2017/04/07 03:20:59
Is there a way to refactor this such that we don't
dvadym
2017/04/07 09:09:01
Yeah, it would look better here, but it looks like
| |
| 2011 | 2011 |
| 2012 base::string16 value; | 2012 base::string16 value; |
| 2013 base::TrimWhitespace(field->value, base::TRIM_ALL, &value); | 2013 base::TrimWhitespace(field->value, base::TRIM_ALL, &value); |
| 2014 | 2014 |
| 2015 for (const AutofillProfile& profile : profiles) | 2015 for (const AutofillProfile& profile : profiles) |
| 2016 profile.GetMatchingTypes(value, app_locale, &matching_types); | 2016 profile.GetMatchingTypes(value, app_locale, &matching_types); |
| 2017 for (const CreditCard& card : credit_cards) | 2017 for (const CreditCard& card : credit_cards) |
| 2018 card.GetMatchingTypes(value, app_locale, &matching_types); | 2018 card.GetMatchingTypes(value, app_locale, &matching_types); |
| 2019 | 2019 |
| 2020 if (matching_types.empty()) | 2020 if (matching_types.empty()) |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2198 } | 2198 } |
| 2199 #endif // ENABLE_FORM_DEBUG_DUMP | 2199 #endif // ENABLE_FORM_DEBUG_DUMP |
| 2200 | 2200 |
| 2201 void AutofillManager::LogCardUploadDecisionUkm( | 2201 void AutofillManager::LogCardUploadDecisionUkm( |
| 2202 AutofillMetrics::CardUploadDecisionMetric upload_decision) { | 2202 AutofillMetrics::CardUploadDecisionMetric upload_decision) { |
| 2203 AutofillMetrics::LogCardUploadDecisionUkm( | 2203 AutofillMetrics::LogCardUploadDecisionUkm( |
| 2204 client_->GetUkmService(), pending_upload_request_url_, upload_decision); | 2204 client_->GetUkmService(), pending_upload_request_url_, upload_decision); |
| 2205 } | 2205 } |
| 2206 | 2206 |
| 2207 } // namespace autofill | 2207 } // namespace autofill |
| OLD | NEW |