summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_dialog_controller_mac.h
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-12 04:24:08 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-12 04:24:08 +0000
commit8ebfa3b67a5d756c9fba7f4f4925dd0c30d16e58 (patch)
tree91f07b26d01569dbc07f00ced3ca45ed3e9e959c /chrome/browser/autofill/autofill_dialog_controller_mac.h
parent8b6b3cf3e623d8f48069aa30a23bca58852d0b36 (diff)
downloadchromium_src-8ebfa3b67a5d756c9fba7f4f4925dd0c30d16e58.zip
chromium_src-8ebfa3b67a5d756c9fba7f4f4925dd0c30d16e58.tar.gz
chromium_src-8ebfa3b67a5d756c9fba7f4f4925dd0c30d16e58.tar.bz2
Autofill dialog for the Mac. This is UI only at this point. The UI is not hooked up to the back end yet. The UI demonstrates manipulation of one address and one credit card record. Eventually buttons will be added to add and remove additional records. The additions in this CL are:
- Preferences dialog has a new "Change autofill settings" button that triggers an autofill settings dialog. - The autofill settings dialog now exists and allows the user to manipulate form autofill data. Specifically address information and credit card information. - Each address or credit card record is presented in a disclosure view to allow for summary or detailed views of each record. - The autofill dialog is layed out dynamically in a vertical list (ordered by y) using the VerticalLayoutView. - Sections are delimited visually with the SectionSeparatorView. There are currently two sections, one for addresses and one for credit cards. - Unit tests are present that exercise the invocation of the dialog and check basic functionality. Checks are performed to see that data is flowing from core profile and credit card data structures into Cocoa model data structures used for bindings internally by the UI. - There are three .xib files (AutoFillDialog.xib, AutoFillAddressFormView.xib, and AutoFillCreditCardFormView.xib) that partition the dialog UI into distinct views, controllers, and model objects. - Cocoa databinding is utilized to syncronize dependent parts of the UI. - All strings are stored in internationalized form in .grd files and .xib files (with one small TODO execption, see below). The things remaining to do are: - Hook the UI up to the backend model, specifically the PersonalDataManager data. - Add support for arbitrary number of address and credit card records. I.e. Add and Delete buttons. - Scroll-to-Point support for autoscrolling when tabbing between fields. - Billing and shipping address popups in the credit card section. - Any validation of input (need to circle back with UI folks on this). - Input validation unit tests. - String concatenation of the summary label needs to be internationalized. BUG=33029 TEST=none Review URL: http://codereview.chromium.org/558066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_dialog_controller_mac.h')
-rw-r--r--chrome/browser/autofill/autofill_dialog_controller_mac.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.h b/chrome/browser/autofill/autofill_dialog_controller_mac.h
new file mode 100644
index 0000000..6e1d8e3
--- /dev/null
+++ b/chrome/browser/autofill/autofill_dialog_controller_mac.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_MAC_
+#define CHROME_BROWSER_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_MAC_
+
+#import <Cocoa/Cocoa.h>
+#include <vector>
+#include "base/scoped_nsobject.h"
+#include "chrome/browser/autofill/autofill_dialog.h"
+#include "chrome/browser/autofill/autofill_profile.h"
+#include "chrome/browser/autofill/credit_card.h"
+
+@class AutoFillAddressViewController;
+@class AutoFillCreditCardViewController;
+@class SectionSeparatorView;
+
+// A window controller for managing the autofill options dialog.
+// Application modally presents a dialog allowing the user to store
+// personal address and credit card information.
+@interface AutoFillDialogController : NSWindowController {
+ @private
+ IBOutlet NSView* childView_;
+ IBOutlet NSView* addressSection_;
+ 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<AutoFillAddressViewController>
+ addressFormViewController_;
+ scoped_nsobject<AutoFillCreditCardViewController>
+ creditCardFormViewController_;
+
+ AutoFillDialogObserver* observer_; // (weak) not retained
+ std::vector<AutoFillProfile> profiles_;
+ std::vector<CreditCard> creditCards_;
+}
+
+// Main interface for displaying an application modal autofill dialog on screen.
+// This class method creates a new |AutoFillDialogController| and runs it as a
+// modal dialog. The controller autoreleases itself when the dialog is closed.
+// |observer| can be NULL, but if it is, then no notification is sent during
+// call to |save|. If |observer| is non-NULL then its |OnAutoFillDialogApply|
+// method is invoked during |save| with the new address and credit card
+// information.
+// |profiles| and |creditCards| must have non-NULL entries (zero or more).
+// These provide the initial data that is presented to the user.
++ (void)showAutoFillDialogWithObserver:(AutoFillDialogObserver*)observer
+ autoFillProfiles:(const std::vector<AutoFillProfile*>&)profiles
+ creditCards:(const std::vector<CreditCard*>&)creditCards;
+
+// IBActions for the dialog buttons.
+- (IBAction)save:(id)sender;
+- (IBAction)cancel:(id)sender;
+
+@end
+
+// Interface exposed for unit testing.
+@interface AutoFillDialogController (ExposedForUnitTests)
+// Returns an instance of AutoFillDialogController. See |-initWithObserver|
+// for details about arguments.
+// Note: controller is autoreleased when |-closeDialog| is called.
++ (AutoFillDialogController*)controllerWithObserver:
+ (AutoFillDialogObserver*)observer
+ autoFillProfiles:(const std::vector<AutoFillProfile*>&)profiles
+ creditCards:(const std::vector<CreditCard*>&)creditCards;
+
+- (id)initWithObserver:(AutoFillDialogObserver*)observer
+ autoFillProfiles:(const std::vector<AutoFillProfile*>&)profiles
+ creditCards:(const std::vector<CreditCard*>&)creditCards;
+- (AutoFillAddressViewController*)addressFormViewController;
+- (AutoFillCreditCardViewController*)creditCardFormViewController;
+- (void)closeDialog;
+@end
+
+#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_DIALOG_CONTROLLER_MAC_