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_ADDRESS_MODEL_MAC_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_ADDRESS_MODEL_MAC_ |
| 7 |
| 8 #import <Cocoa/Cocoa.h> |
| 9 |
| 10 class AutoFillProfile; |
| 11 |
| 12 // A "model" class used with bindings mechanism and the |
| 13 // |AutoFillAddressViewController| 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 a given profile using the designated |
| 17 // initializer |initWithProfile:|. |
| 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 AutoFillAddressModel : NSObject { |
| 22 @private |
| 23 // These are not scoped_nsobjects because we use them via KVO/bindings. |
| 24 NSString* label_; |
| 25 NSString* firstName_; |
| 26 NSString* middleName_; |
| 27 NSString* lastName_; |
| 28 NSString* email_; |
| 29 NSString* companyName_; |
| 30 NSString* addressLine1_; |
| 31 NSString* addressLine2_; |
| 32 NSString* city_; |
| 33 NSString* state_; |
| 34 NSString* zip_; |
| 35 NSString* country_; |
| 36 NSString* phoneCountryCode_; |
| 37 NSString* phoneAreaCode_; |
| 38 NSString* phoneNumber_; |
| 39 NSString* faxCountryCode_; |
| 40 NSString* faxAreaCode_; |
| 41 NSString* faxNumber_; |
| 42 } |
| 43 |
| 44 // |summary| is a derived property based on |firstName|, |lastName| and |
| 45 // |addressLine1|. KVO observers receive change notifications for |summary| |
| 46 // when any of these properties change. |
| 47 @property (readonly) NSString* summary; |
| 48 @property (nonatomic, copy) NSString* label; |
| 49 @property (nonatomic, copy) NSString* firstName; |
| 50 @property (nonatomic, copy) NSString* middleName; |
| 51 @property (nonatomic, copy) NSString* lastName; |
| 52 @property (nonatomic, copy) NSString* email; |
| 53 @property (nonatomic, copy) NSString* companyName; |
| 54 @property (nonatomic, copy) NSString* addressLine1; |
| 55 @property (nonatomic, copy) NSString* addressLine2; |
| 56 @property (nonatomic, copy) NSString* city; |
| 57 @property (nonatomic, copy) NSString* state; |
| 58 @property (nonatomic, copy) NSString* zip; |
| 59 @property (nonatomic, copy) NSString* country; |
| 60 @property (nonatomic, copy) NSString* phoneCountryCode; |
| 61 @property (nonatomic, copy) NSString* phoneAreaCode; |
| 62 @property (nonatomic, copy) NSString* phoneNumber; |
| 63 @property (nonatomic, copy) NSString* faxCountryCode; |
| 64 @property (nonatomic, copy) NSString* faxAreaCode; |
| 65 @property (nonatomic, copy) NSString* faxNumber; |
| 66 |
| 67 // The designated initializer. Initializes the property strings to values |
| 68 // retrieved from the |profile|. |
| 69 - (id)initWithProfile:(const AutoFillProfile&)profile; |
| 70 |
| 71 // This method copies internal NSString property values into the |
| 72 // |profile| object's fields as appropriate. |profile| should never be NULL. |
| 73 - (void)copyModelToProfile:(AutoFillProfile*)profile; |
| 74 |
| 75 @end |
| 76 |
| 77 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_ADDRESS_MODEL_MAC_ |
OLD | NEW |