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