diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 19:23:22 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-19 19:23:22 +0000 |
commit | f52b213bae456f35125bcd85d47bd6382374ee31 (patch) | |
tree | 7448b9449a0a8974d49575598b687542a5823e2e /chrome/browser/autofill | |
parent | fb1f4490e033de5d9f9d4592d243f11d3bb3961c (diff) | |
download | chromium_src-f52b213bae456f35125bcd85d47bd6382374ee31.zip chromium_src-f52b213bae456f35125bcd85d47bd6382374ee31.tar.gz chromium_src-f52b213bae456f35125bcd85d47bd6382374ee31.tar.bz2 |
AutoFill: Don't send suggestions for empty field values.
BUG=41265
TEST=none
Review URL: http://codereview.chromium.org/1574037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r-- | chrome/browser/autofill/autofill_manager.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index 7a23f9b..e174898 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -34,7 +34,6 @@ const double kAutoFillNegativeUploadRateDefaultValue = 0.01; const char* kAutoFillLearnMoreUrl = "http://www.google.com/support/chrome/bin/answer.py?answer=142893"; - AutoFillManager::AutoFillManager(TabContents* tab_contents) : tab_contents_(tab_contents), personal_data_(NULL), @@ -157,8 +156,10 @@ bool AutoFillManager::GetAutoFillSuggestions(int query_id, for (std::vector<AutoFillProfile*>::const_iterator iter = profiles.begin(); iter != profiles.end(); ++iter) { - if (StartsWith((*iter)->GetFieldText(AutoFillType(form_field->type())), - field.value(), false)) { + string16 field_text = + (*iter)->GetFieldText(AutoFillType(form_field->type())); + if (!field.value().empty() && + StartsWith(field_text, field.value(), false)) { string16 value = (*iter)->GetFieldText(AutoFillType(form_field->type())); string16 label = (*iter)->Label(); @@ -169,9 +170,10 @@ bool AutoFillManager::GetAutoFillSuggestions(int query_id, for (std::vector<CreditCard*>::const_iterator iter = credit_cards.begin(); iter != credit_cards.end(); ++iter) { - // TODO(jhawkins): What if GetFieldText(...).length() == 0? - if (StartsWith((*iter)->GetFieldText(AutoFillType(form_field->type())), - field.value(), false)) { + string16 field_text = + (*iter)->GetFieldText(AutoFillType(form_field->type())); + if (!field.value().empty() && + StartsWith(field_text, field.value(), false)) { string16 value; if (form_field->type() == CREDIT_CARD_NUMBER) { value = (*iter)->ObfuscatedNumber(); |