summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-01 00:09:05 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-01 00:09:05 +0000
commitfafe725f5dfb6f97de65c3082294875c28ae53f7 (patch)
tree55f18553de254e6882cbdce929366bc45b46ec75 /chrome/browser/ui
parent655e4ac982e7a3957e66adbe568fcf6faece30d7 (diff)
downloadchromium_src-fafe725f5dfb6f97de65c3082294875c28ae53f7.zip
chromium_src-fafe725f5dfb6f97de65c3082294875c28ae53f7.tar.gz
chromium_src-fafe725f5dfb6f97de65c3082294875c28ae53f7.tar.bz2
Only show one placeholder row in 'Edit Autofill address' name list for profiles without name info.
BUG=98280 TEST=none Review URL: http://codereview.chromium.org/8068014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/webui/options/autofill_options_handler.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
index cab4023..9072702 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
@@ -99,9 +99,15 @@ DictionaryValue* GetCountryData() {
void GetValueList(const AutofillProfile& profile,
AutofillFieldType type,
scoped_ptr<ListValue>* list) {
+ list->reset(new ListValue);
+
std::vector<string16> values;
profile.GetMultiInfo(type, &values);
- list->reset(new ListValue);
+
+ // |GetMultiInfo()| always returns at least one, potentially empty, item.
+ if (values.size() == 1 && values.front().empty())
+ return;
+
for (size_t i = 0; i < values.size(); ++i) {
(*list)->Set(i, Value::CreateStringValue(values[i]));
}
@@ -123,6 +129,8 @@ void SetValueList(const ListValue* list,
// Get the multi-valued element for |type| and return it in |ListValue| form.
void GetNameList(const AutofillProfile& profile,
scoped_ptr<ListValue>* names) {
+ names->reset(new ListValue);
+
std::vector<string16> first_names;
std::vector<string16> middle_names;
std::vector<string16> last_names;
@@ -132,7 +140,12 @@ void GetNameList(const AutofillProfile& profile,
DCHECK_EQ(first_names.size(), middle_names.size());
DCHECK_EQ(first_names.size(), last_names.size());
- names->reset(new ListValue);
+ // |GetMultiInfo()| always returns at least one, potentially empty, item.
+ if (first_names.size() == 1 && first_names.front().empty() &&
+ middle_names.front().empty() && last_names.front().empty()) {
+ return;
+ }
+
for (size_t i = 0; i < first_names.size(); ++i) {
ListValue* name = new ListValue; // owned by |list|
name->Set(0, Value::CreateStringValue(first_names[i]));