| Index: chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h
|
| diff --git a/chrome/browser/autofill/autofill_credit_card_view_controller_mac.h b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h
|
| similarity index 51%
|
| rename from chrome/browser/autofill/autofill_credit_card_view_controller_mac.h
|
| rename to chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h
|
| index 054252f920ec6774c81f5088df2e489f1aba0b9f..6fa281df6d95a697bac179e0872d38ef096f52bd 100644
|
| --- a/chrome/browser/autofill/autofill_credit_card_view_controller_mac.h
|
| +++ b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h
|
| @@ -2,24 +2,36 @@
|
| // 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_CREDIT_CARD_VIEW_CONTROLLER_MAC_
|
| -#define CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_VIEW_CONTROLLER_MAC_
|
| +#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_SHEET_CONTROLLER_MAC_
|
| +#define CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_SHEET_CONTROLLER_MAC_
|
|
|
| #import <Cocoa/Cocoa.h>
|
| -#import "chrome/browser/cocoa/disclosure_view_controller.h"
|
|
|
| @class AutoFillCreditCardModel;
|
| @class AutoFillDialogController;
|
| class CreditCard;
|
|
|
| +// The sheet can be invoked in "Add" or "Edit" mode. This dictates the caption
|
| +// seen at the top of the sheet.
|
| +enum {
|
| + kAutoFillCreditCardAddMode = 0,
|
| + kAutoFillCreditCardEditMode = 1
|
| +};
|
| +typedef NSInteger AutoFillCreditCardMode;
|
| +
|
| // A class that coordinates the |creditCardModel| and the associated view
|
| -// held in AutoFillCreditCardFormView.xib.
|
| +// held in AutoFillCreditCardSheet.xib.
|
| // |initWithCreditCard:| is the designated initializer. It takes |creditCard|
|
| // and transcribes it to |creditCardModel| to which the view is bound.
|
| -@interface AutoFillCreditCardViewController : DisclosureViewController {
|
| +@interface AutoFillCreditCardSheetController : NSWindowController {
|
| @private
|
| IBOutlet NSPopUpButton* billingAddressPopup_;
|
| - IBOutlet NSPopUpButton* shippingAddressPopup_;
|
| + IBOutlet NSPopUpButton* expirationMonthPopup_;
|
| + IBOutlet NSPopUpButton* expirationYearPopup_;
|
| +
|
| + // The caption at top of dialog. Text changes according to usage. Either
|
| + // "New credit card" or "Edit credit card" depending on context.
|
| + IBOutlet NSTextField* caption_;
|
|
|
| // The primary model for this controller. The model is instantiated
|
| // from within |initWithCreditCard:|. We do not hold it as a scoped_nsobject
|
| @@ -32,41 +44,39 @@ class CreditCard;
|
| // of addresses change in the |parentController_|.
|
| NSArray* billingAddressContents_;
|
|
|
| - // Array of strings that populate the |shippingAddressPopup_| control. We
|
| - // do not hold this as scoped_nsobject because it is exposed as a KVO
|
| - // compliant property. The values of this array may change as the list
|
| - // of addresses change in the |parentController_|.
|
| - NSArray* shippingAddressContents_;
|
| + // Contents of the expiration month and year popups. Strongly owned. We do
|
| + // not hold them as scoped_nsobjects because they are exposed as KVO compliant
|
| + // properties.
|
| + NSArray* expirationMonthContents_;
|
| + NSArray* expirationYearContents_;
|
|
|
| - // A reference to our parent controller. Used for notifying parent if/when
|
| - // deletion occurs. May be not be nil.
|
| + // A reference to our parent controller. Used for fetching billing address
|
| + // labels. May be not be nil.
|
| // Weak reference, owns us.
|
| AutoFillDialogController* parentController_;
|
| +
|
| + // Either "Add" or "Edit" mode of sheet.
|
| + AutoFillCreditCardMode mode_;
|
| }
|
|
|
| @property (nonatomic, retain) AutoFillCreditCardModel* creditCardModel;
|
| @property (nonatomic, retain) NSArray* billingAddressContents;
|
| -@property (nonatomic, retain) NSArray* shippingAddressContents;
|
| +@property (nonatomic, retain) NSArray* expirationMonthContents;
|
| +@property (nonatomic, retain) NSArray* expirationYearContents;
|
|
|
| // Designated initializer. Takes a copy of the data in |creditCard|,
|
| // it is not held as a reference.
|
| - (id)initWithCreditCard:(const CreditCard&)creditCard
|
| - disclosure:(NSCellStateValue)disclosureState
|
| + mode:(AutoFillCreditCardMode)mode
|
| controller:(AutoFillDialogController*)parentController;
|
|
|
| -// Action to remove this credit card from the dialog. Forwards the request to
|
| -// |parentController_| which does all the actual work. We have the action
|
| -// here so that the delete button in the AutoFillCreditCardViewFormView.xib has
|
| -// something to call.
|
| -- (IBAction)deleteCreditCard:(id)sender;
|
| -
|
| -// Action to notify observers of the address list when changes have occured.
|
| -// For the credit card controller this means rebuild the popup menus.
|
| -- (IBAction)onAddressesChanged:(id)sender;
|
| +// IBActions for save and cancel buttons. Both invoke |endSheet:|.
|
| +- (IBAction)save:(id)sender;
|
| +- (IBAction)cancel:(id)sender;
|
|
|
| // Copy data from internal model to |creditCard|.
|
| - (void)copyModelToCreditCard:(CreditCard*)creditCard;
|
|
|
| @end
|
|
|
| -#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_VIEW_CONTROLLER_MAC_
|
| +#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_SHEET_CONTROLLER_MAC_
|
|
|