From 74262ecb34f2b2fa1cf20802138a23f31a181e44 Mon Sep 17 00:00:00 2001 From: "dhollowa@chromium.org" Date: Tue, 23 Feb 2010 22:47:42 +0000 Subject: These changes connect the AutoFill UI on the Mac with the back-end data store. Changes to a user's address and credit card information are now persisted. Other changes are: - Selectively disables the preferences "Setup autofill..." button when the PersonalDataManager is not available. - Allows the user to add or remove address or credit card entries in the AutoFill dialog. - The billing and shipping popup menus in the credit card entries now properly reflect the list of addresses. Notes on nib changes: - AutoFillAddressFormView.xib : added Delete button, wired to trigger |deleteAddress:| action. - AutoFillDialog.xib changed window size to encompass new controls. Added "Add Address" and "Add Credit Card" buttons. Wired them up to |addNewAddress:| and |addNewCreditCard:| actions, respectively. - Preferences.xib : |autoFillSettingsButton_| outlet wired up to facilitate disabling when no |PersonalDataManager| is available. - AutoFillCreditCardFormView.xib : added "Delete" button and wired up to |deleteCreditCard:| action. Removed outlets to menus that were only there for temporary disablement reasons. Set up bindings for billing and shipping address menu items and for their selected item. BUG=33029 TEST=unit_tests --gtest_filter=AutoFillDialogControllerTest.* Note new: Google Test filter = AutoFillDialogControllerTest.*:AutoFillAddressModelTest.*:AutoFillAddressViewControllerTest.*:AutoFillCreditCardModelTest.*:AutoFillCreditCardViewControllerTest.*:DisclosureViewControllerTest.*:SectionSeparatorViewTest.*:VerticalLayoutViewTest.* Review URL: http://codereview.chromium.org/650163 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39787 0039d316-1c4b-4281-b951-d872f2087c98 --- .../autofill/autofill_dialog_controller_mac.h | 35 +++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'chrome/browser/autofill/autofill_dialog_controller_mac.h') diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.h b/chrome/browser/autofill/autofill_dialog_controller_mac.h index 6e1d8e3..322e4cc 100644 --- a/chrome/browser/autofill/autofill_dialog_controller_mac.h +++ b/chrome/browser/autofill/autofill_dialog_controller_mac.h @@ -26,18 +26,17 @@ IBOutlet SectionSeparatorView* addressSectionBox_; IBOutlet NSView* creditCardSection_; - // TODO(dhollowa): one each of these for now. Will be n of each - // controller eventually, for n addresses and n credit cards. // Note on ownership: the controllers are strongly owned by the dialog // controller. Their views are inserted into the dialog's view hierarcy // but are retained by these controllers as well. - // See http://crbug.com/33029. - scoped_nsobject - addressFormViewController_; - scoped_nsobject - creditCardFormViewController_; - AutoFillDialogObserver* observer_; // (weak) not retained + // Array of |AutoFillAddressViewController|. + scoped_nsobject addressFormViewControllers_; + + // Array of |AutoFillCreditCardViewController|. + scoped_nsobject creditCardFormViewControllers_; + + AutoFillDialogObserver* observer_; // Weak, not retained. std::vector profiles_; std::vector creditCards_; } @@ -59,6 +58,22 @@ - (IBAction)save:(id)sender; - (IBAction)cancel:(id)sender; +// IBActions for adding new items. +- (IBAction)addNewAddress:(id)sender; +- (IBAction)addNewCreditCard:(id)sender; + +// IBActions for deleting items. |sender| is expected to be either a +// |AutoFillAddressViewController| or a |AutoFillCreditCardViewController|. +- (IBAction)deleteAddress:(id)sender; +- (IBAction)deleteCreditCard:(id)sender; + +// IBAction for sender to alert dialog that an address label has changed. +- (IBAction)notifyAddressChange:(id)sender; + +// Returns an array of strings representing the addresses in the +// |addressFormViewControllers_|. +- (NSArray*)addressStrings; + @end // Interface exposed for unit testing. @@ -74,8 +89,8 @@ - (id)initWithObserver:(AutoFillDialogObserver*)observer autoFillProfiles:(const std::vector&)profiles creditCards:(const std::vector&)creditCards; -- (AutoFillAddressViewController*)addressFormViewController; -- (AutoFillCreditCardViewController*)creditCardFormViewController; +- (NSMutableArray*)addressFormViewControllers; +- (NSMutableArray*)creditCardFormViewControllers; - (void)closeDialog; @end -- cgit v1.1