summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-22 22:43:57 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-22 22:43:57 +0000
commit29f608829d5142ea1bd2dec1781f41dbad7547b0 (patch)
treeb88ef05d4537b41b12267afc56d17ee3d18b03e4 /chrome/browser/views
parent096d5ac1832c96d25a28d6c3cb1bd710d0e73042 (diff)
downloadchromium_src-29f608829d5142ea1bd2dec1781f41dbad7547b0.zip
chromium_src-29f608829d5142ea1bd2dec1781f41dbad7547b0.tar.gz
chromium_src-29f608829d5142ea1bd2dec1781f41dbad7547b0.tar.bz2
Fixes bug in windows autofill address editor not using the correct
phone/fax fields for saving phone numbers. BUG=49981 TEST=see bug Review URL: http://codereview.chromium.org/3047010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53406 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/autofill_profiles_view_win.cc37
-rw-r--r--chrome/browser/views/autofill_profiles_view_win.h5
2 files changed, 29 insertions, 13 deletions
diff --git a/chrome/browser/views/autofill_profiles_view_win.cc b/chrome/browser/views/autofill_profiles_view_win.cc
index e7ebf7a..d054d79 100644
--- a/chrome/browser/views/autofill_profiles_view_win.cc
+++ b/chrome/browser/views/autofill_profiles_view_win.cc
@@ -553,9 +553,8 @@ bool AutoFillProfilesView::PhoneSubView::IsValid() const {
return true;
// Try to parse it.
- string16 country, city, stripped_phone;
- return PhoneNumber::ParsePhoneNumber(phone, &country, &city,
- &stripped_phone);
+ string16 number, city, country;
+ return PhoneNumber::ParsePhoneNumber(phone, &number, &city, &country);
}
return false;
}
@@ -628,9 +627,9 @@ AutoFillProfilesView::EditableSetViewContents::TextFieldToAutoFill
{ AutoFillProfilesView::EditableSetViewContents::TEXT_ADDRESS_COUNTRY,
ADDRESS_HOME_COUNTRY },
{ AutoFillProfilesView::EditableSetViewContents::TEXT_PHONE_PHONE,
- PHONE_HOME_NUMBER },
+ PHONE_HOME_WHOLE_NUMBER },
{ AutoFillProfilesView::EditableSetViewContents::TEXT_FAX_PHONE,
- PHONE_FAX_NUMBER },
+ PHONE_FAX_WHOLE_NUMBER },
};
AutoFillProfilesView::EditableSetViewContents::TextFieldToAutoFill
@@ -822,7 +821,6 @@ void AutoFillProfilesView::EditableSetViewContents::ButtonPressed(
NOTREACHED();
}
-
/////////////////////////////////////////////////////////////////////////////
// AutoFillProfilesView::EditableSetViewContents,
// views::Textfield::Controller implementations
@@ -832,10 +830,11 @@ void AutoFillProfilesView::EditableSetViewContents::ContentsChanged(
for (int field = 0; field < arraysize(address_fields_); ++field) {
DCHECK(text_fields_[address_fields_[field].text_field]);
if (text_fields_[address_fields_[field].text_field] == sender) {
- UpdateContentsPhoneViews(address_fields_[field].text_field,
- sender, new_contents);
- temporary_info_.address.SetInfo(
- AutoFillType(address_fields_[field].type), new_contents);
+ if (!UpdateContentsPhoneViews(address_fields_[field].text_field,
+ sender, new_contents)) {
+ temporary_info_.address.SetInfo(
+ AutoFillType(address_fields_[field].type), new_contents);
+ }
UpdateButtons();
return;
}
@@ -1188,7 +1187,7 @@ void AutoFillProfilesView::EditableSetViewContents::UpdateButtons() {
GetDialogClientView()->UpdateDialogButtons();
}
-void AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews(
+bool AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews(
TextFields field, views::Textfield* sender, const string16& new_contents) {
switch (field) {
case TEXT_PHONE_PHONE:
@@ -1196,8 +1195,22 @@ void AutoFillProfilesView::EditableSetViewContents::UpdateContentsPhoneViews(
for (std::vector<PhoneSubView*>::iterator it = phone_sub_views_.begin();
it != phone_sub_views_.end(); ++it)
(*it)->ContentsChanged(sender, new_contents);
- } break;
+ DCHECK(temporary_info_.is_address); // Only addresses have phone numbers.
+ string16 number, city, country;
+ PhoneNumber::ParsePhoneNumber(new_contents, &number, &city, &country);
+ temporary_info_.address.SetInfo(
+ AutoFillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_COUNTRY_CODE :
+ PHONE_FAX_COUNTRY_CODE), country);
+ temporary_info_.address.SetInfo(
+ AutoFillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_CITY_CODE :
+ PHONE_FAX_CITY_CODE), city);
+ temporary_info_.address.SetInfo(
+ AutoFillType(field == TEXT_PHONE_PHONE ? PHONE_HOME_NUMBER :
+ PHONE_FAX_NUMBER), number);
+ return true;
+ }
}
+ return false;
}
/////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/views/autofill_profiles_view_win.h b/chrome/browser/views/autofill_profiles_view_win.h
index 57889e5..f3a3595 100644
--- a/chrome/browser/views/autofill_profiles_view_win.h
+++ b/chrome/browser/views/autofill_profiles_view_win.h
@@ -305,7 +305,10 @@ class AutoFillProfilesView : public views::View,
void UpdateButtons();
- void UpdateContentsPhoneViews(TextFields field,
+ // If |field| is a phone or fax ContentsChanged is passed to the
+ // PhoneSubView, the appropriate fields in |temporary_info_| are updated and
+ // true is returned. Otherwise false is returned.
+ bool UpdateContentsPhoneViews(TextFields field,
views::Textfield* sender,
const string16& new_contents);