summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_dialog_controller_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autofill/autofill_dialog_controller_mac.mm')
-rw-r--r--chrome/browser/autofill/autofill_dialog_controller_mac.mm60
1 files changed, 7 insertions, 53 deletions
diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
index f48f952..c1f193c 100644
--- a/chrome/browser/autofill/autofill_dialog_controller_mac.mm
+++ b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
@@ -32,20 +32,6 @@ namespace {
// dialog.
typedef std::map<Profile*, AutoFillDialogController*> ProfileControllerMap;
-// Update profile labels passed as |input|. When profile data changes as a
-// result of adding new profiles, edititing existing profiles, or deleting a
-// profile, then the list of profiles need to have their derived labels
-// recomputed.
-void UpdateProfileLabels(std::vector<AutoFillProfile>* input) {
- DCHECK(input);
- std::vector<AutoFillProfile*> profiles;
- profiles.resize(input->size());
- for (size_t i = 0; i < input->size(); ++i) {
- profiles[i] = &(*input)[i];
- }
- AutoFillProfile::AdjustInferredLabels(&profiles);
-}
-
} // namespace
// Delegate protocol that needs to be in place for the AutoFillTableView's
@@ -295,8 +281,7 @@ class PreferenceObserver : public NotificationObserver {
DCHECK(!addressSheetController.get());
// Create a new default address.
- string16 newName = l10n_util::GetStringUTF16(IDS_AUTOFILL_NEW_ADDRESS);
- AutoFillProfile newAddress(newName, 0);
+ AutoFillProfile newAddress;
// Create a new address sheet controller in "Add" mode.
addressSheetController.reset(
@@ -318,15 +303,13 @@ class PreferenceObserver : public NotificationObserver {
DCHECK(!creditCardSheetController.get());
// Create a new default credit card.
- string16 newName = l10n_util::GetStringUTF16(IDS_AUTOFILL_NEW_CREDITCARD);
- CreditCard newCreditCard(newName, 0);
+ CreditCard newCreditCard;
// Create a new address sheet controller in "Add" mode.
creditCardSheetController.reset(
[[AutoFillCreditCardSheetController alloc]
initWithCreditCard:newCreditCard
- mode:kAutoFillCreditCardAddMode
- controller:self]);
+ mode:kAutoFillCreditCardAddMode]);
// Show the sheet.
[NSApp beginSheet:[creditCardSheetController window]
@@ -344,7 +327,7 @@ class PreferenceObserver : public NotificationObserver {
if (returnCode) {
// Create a new address and save it to the |profiles_| list.
- AutoFillProfile newAddress(string16(), 0);
+ AutoFillProfile newAddress;
[addressSheetController copyModelToProfile:&newAddress];
if (!newAddress.IsEmpty()) {
profiles_.push_back(newAddress);
@@ -371,7 +354,7 @@ class PreferenceObserver : public NotificationObserver {
if (returnCode) {
// Create a new credit card and save it to the |creditCards_| list.
- CreditCard newCreditCard(string16(), 0);
+ CreditCard newCreditCard;
[creditCardSheetController copyModelToCreditCard:&newCreditCard];
if (!newCreditCard.IsEmpty()) {
creditCards_.push_back(newCreditCard);
@@ -458,8 +441,7 @@ class PreferenceObserver : public NotificationObserver {
creditCardSheetController.reset(
[[AutoFillCreditCardSheetController alloc]
initWithCreditCard:creditCards_[i]
- mode:kAutoFillCreditCardEditMode
- controller:self]);
+ mode:kAutoFillCreditCardEditMode]);
// Show the sheet.
[NSApp beginSheet:[creditCardSheetController window]
@@ -619,33 +601,6 @@ class PreferenceObserver : public NotificationObserver {
return 0;
}
-- (void)addressLabels:(NSArray**)labels addressIDs:(std::vector<int>*)ids {
- NSUInteger capacity = profiles_.size();
- NSMutableArray* array = [NSMutableArray arrayWithCapacity:capacity];
- ids->clear();
-
- std::vector<AutoFillProfile>::iterator i;
- for (i = profiles_.begin(); i != profiles_.end(); ++i) {
- FieldTypeSet fields;
- i->GetAvailableFieldTypes(&fields);
- if (fields.find(ADDRESS_HOME_LINE1) == fields.end() &&
- fields.find(ADDRESS_HOME_LINE2) == fields.end() &&
- fields.find(ADDRESS_HOME_APT_NUM) == fields.end() &&
- fields.find(ADDRESS_HOME_CITY) == fields.end() &&
- fields.find(ADDRESS_HOME_STATE) == fields.end() &&
- fields.find(ADDRESS_HOME_ZIP) == fields.end() &&
- fields.find(ADDRESS_HOME_COUNTRY) == fields.end()) {
- // No address information in this profile; it's useless as a billing
- // address.
- continue;
- }
- [array addObject:SysUTF16ToNSString(i->Label())];
- ids->push_back(i->unique_id());
- }
-
- *labels = array;
-}
-
// Accessor for |autoFillEnabled| preference state. Note: a checkbox in Nib
// is bound to this via KVO.
- (BOOL)autoFillEnabled {
@@ -841,7 +796,6 @@ class PreferenceObserver : public NotificationObserver {
iter != creditCards.end(); ++iter)
creditCards_.push_back(**iter);
- UpdateProfileLabels(&profiles_);
[tableView_ reloadData];
}
@@ -934,7 +888,7 @@ class PreferenceObserver : public NotificationObserver {
// TODO(dhollowa): Using SetInfo() call to validate phone number. Should
// have explicit validation method. More robust validation is needed as
// well eventually.
- AutoFillProfile profile(string16(), 0);
+ AutoFillProfile profile;
profile.SetInfo(AutoFillType(PHONE_HOME_WHOLE_NUMBER),
base::SysNSStringToUTF16(string));
if (profile.GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER)).empty()) {