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

Unified Diff: chrome/browser/autofill/autofill_manager.cc

Issue 2835026: Added inferred labels implementation. Label inferred from the person name + d... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_manager.cc
===================================================================
--- chrome/browser/autofill/autofill_manager.cc (revision 52727)
+++ chrome/browser/autofill/autofill_manager.cc (working copy)
@@ -451,6 +451,7 @@
std::vector<string16>* labels,
std::vector<int>* unique_ids) {
const std::vector<AutoFillProfile*>& profiles = personal_data_->profiles();
+ std::vector<AutoFillProfile*> matched_profiles;
for (std::vector<AutoFillProfile*>::const_iterator iter = profiles.begin();
iter != profiles.end(); ++iter) {
AutoFillProfile* profile = *iter;
@@ -460,23 +461,33 @@
if (!profile_field_value.empty() &&
StartsWith(profile_field_value, field.value(), false)) {
- if (!form->HasBillingFields()) {
- values->push_back(profile_field_value);
- labels->push_back(profile->Label());
+ matched_profiles.push_back(profile);
+ values->push_back(profile_field_value);
+ unique_ids->push_back(profile->unique_id());
+ }
+ }
+ AutoFillProfile::CreateInferredLabels(&matched_profiles, labels, 0,
+ type.field_type());
+ if (form->HasBillingFields()) {
+ size_t i = 0;
+ std::vector<string16> expanded_values;
+ std::vector<string16> expanded_labels;
+ for (std::vector<AutoFillProfile*>::const_iterator iter =
+ matched_profiles.begin(); iter != matched_profiles.end();
+ ++iter, ++i) {
+ AutoFillProfile* profile = *iter;
+ for (std::vector<CreditCard*>::const_iterator cc =
+ personal_data_->credit_cards().begin();
+ cc != personal_data_->credit_cards().end(); ++cc) {
+ expanded_values.push_back((*values)[i]);
+ string16 label = (*labels)[i] + kLabelSeparator +
+ (*cc)->LastFourDigits();
+ expanded_labels.push_back(label);
unique_ids->push_back(profile->unique_id());
- } else {
- for (std::vector<CreditCard*>::const_iterator cc =
- personal_data_->credit_cards().begin();
- cc != personal_data_->credit_cards().end(); ++cc) {
- values->push_back(profile_field_value);
-
- string16 label = profile->Label() + kLabelSeparator +
- (*cc)->LastFourDigits();
- labels->push_back(label);
- unique_ids->push_back(profile->unique_id());
- }
}
}
+ expanded_labels.swap(*labels);
+ expanded_values.swap(*values);
}
}
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698