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 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 class CreditCard; | 11 class CreditCard; |
12 | 12 |
13 // A "model" class used with bindings mechanism and the | 13 // A "model" class used with bindings mechanism and the |
14 // |AutoFillCreditCardViewController| to achieve the form-like view | 14 // |AutoFillCreditCardViewController| to achieve the form-like view |
15 // of autofill data in the Chrome options UI. | 15 // of autofill data in the Chrome options UI. |
16 // Model objects are initialized from the given |creditCard| using the | 16 // Model objects are initialized from the given |creditCard| using the |
17 // designated initializer |initWithCreditCard:|. | 17 // designated initializer |initWithCreditCard:|. |
18 // Users of this class must be prepared to handle nil string return values. | 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 | 19 // The KVO/bindings mechanisms expect this and deal with nil string values |
20 // appropriately. | 20 // appropriately. |
21 @interface AutoFillCreditCardModel : NSObject { | 21 @interface AutoFillCreditCardModel : NSObject { |
22 @private | 22 @private |
23 // These are not scoped_nsobjects because we use them via KVO/bindings. | 23 // These are not scoped_nsobjects because we use them via KVO/bindings. |
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 } | 28 } |
29 | 29 |
30 @property (nonatomic, copy) NSString* nameOnCard; | 30 @property(nonatomic, copy) NSString* nameOnCard; |
31 @property (nonatomic, copy) NSString* creditCardNumber; | 31 @property(nonatomic, copy) NSString* creditCardNumber; |
32 @property (nonatomic, copy) NSString* expirationMonth; | 32 @property(nonatomic, copy) NSString* expirationMonth; |
33 @property (nonatomic, copy) NSString* expirationYear; | 33 @property(nonatomic, copy) NSString* expirationYear; |
34 | 34 |
35 // Designated initializer. Initializes the property strings to values retrieved | 35 // Designated initializer. Initializes the property strings to values retrieved |
36 // from the |creditCard| object. | 36 // from the |creditCard| object. |
37 - (id)initWithCreditCard:(const CreditCard&)creditCard; | 37 - (id)initWithCreditCard:(const CreditCard&)creditCard; |
38 | 38 |
39 // This method copies internal NSString property values into the | 39 // This method copies internal NSString property values into the |
40 // |creditCard| object's fields as appropriate. |creditCard| should never | 40 // |creditCard| object's fields as appropriate. |creditCard| should never |
41 // be NULL. | 41 // be NULL. |
42 - (void)copyModelToCreditCard:(CreditCard*)creditCard; | 42 - (void)copyModelToCreditCard:(CreditCard*)creditCard; |
43 | 43 |
44 @end | 44 @end |
45 | 45 |
46 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_MODEL_MAC_ | 46 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_CREDIT_CARD_MODEL_MAC_ |
OLD | NEW |