OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_MODEL_MAC_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_MODEL_MAC_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 class CreditCard; |
| 11 |
| 12 // A "model" class used with bindings mechanism and the |
| 13 // |AutoFillCreditCardViewController| to achieve the form-like view |
| 14 // of autofill data in the Chrome options UI. |
| 15 // Note that |summary| is a derived property. |
| 16 // Model objects are initialized from the given |creditCard| using the |
| 17 // designated initializer |initWithCreditCard:|. |
| 18 // Users of this class must be prepared to handle nil string return values. |
| 19 // The KVO/bindings mechanisms expect this and deal with nil string values |
| 20 // appropriately. |
| 21 @interface AutoFillCreditCardModel : NSObject { |
| 22 @private |
| 23 // These are not scoped_nsobjects because we use them via KVO/bindings. |
| 24 NSString* label_; |
| 25 NSString* nameOnCard_; |
| 26 NSString* creditCardNumber_; |
| 27 NSString* expirationMonth_; |
| 28 NSString* expirationYear_; |
| 29 NSString* cvcCode_; |
| 30 NSString* billingAddress_; |
| 31 NSString* shippingAddress_; |
| 32 } |
| 33 |
| 34 // |summary| is a derived property based on |creditCardNumber|, |
| 35 // |expirationMonth| and |expirationYear|. KVO observers receive change |
| 36 // notifications for |summary| when any of these properties change. |
| 37 @property (readonly) NSString* summary; |
| 38 @property (nonatomic, copy) NSString* label; |
| 39 @property (nonatomic, copy) NSString* nameOnCard; |
| 40 @property (nonatomic, copy) NSString* creditCardNumber; |
| 41 @property (nonatomic, copy) NSString* expirationMonth; |
| 42 @property (nonatomic, copy) NSString* expirationYear; |
| 43 @property (nonatomic, copy) NSString* cvcCode; |
| 44 @property (nonatomic, copy) NSString* billingAddress; |
| 45 @property (nonatomic, copy) NSString* shippingAddress; |
| 46 |
| 47 // Designated initializer. Initializes the property strings to values retrieved |
| 48 // from the |creditCard| object. |
| 49 - (id)initWithCreditCard:(const CreditCard&)creditCard; |
| 50 |
| 51 // This method copies internal NSString property values into the |
| 52 // |creditCard| object's fields as appropriate. |creditCard| should never |
| 53 // be NULL. |
| 54 - (void)copyModelToCreditCard:(CreditCard*)creditCard; |
| 55 |
| 56 @end |
| 57 |
| 58 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_MODEL_MAC_ |
OLD | NEW |