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 #import "chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h" | 5 #import "chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" | 10 #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" |
11 #import "chrome/browser/autofill/autofill_dialog_controller_mac.h" | 11 #import "chrome/browser/autofill/autofill_dialog_controller_mac.h" |
12 #include "chrome/browser/autofill/credit_card.h" | 12 #include "chrome/browser/autofill/credit_card.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 | 14 |
15 // Interface exposed for unit testing. | 15 // Interface exposed for unit testing. |
16 @implementation AutoFillCreditCardSheetController (ExposedForUnitTests) | 16 @implementation AutoFillCreditCardSheetController (ExposedForUnitTests) |
17 - (NSTextField*)creditCardNumberField { | 17 - (NSTextField*)creditCardNumberField { |
18 return creditCardNumberField_; | 18 return creditCardNumberField_; |
19 } | 19 } |
20 @end | 20 @end |
21 | 21 |
22 // Private methods for the |AutoFillCreditCardSheetController| class. | 22 // Private methods for the |AutoFillCreditCardSheetController| class. |
23 @interface AutoFillCreditCardSheetController (PrivateMethods) | 23 @interface AutoFillCreditCardSheetController (PrivateMethods) |
24 - (void)buildExpirationMonthContents; | 24 - (void)buildExpirationMonthContents; |
25 - (void)buildExpirationYearContents; | 25 - (void)buildExpirationYearContents; |
26 @end | 26 @end |
27 | 27 |
28 @implementation AutoFillCreditCardSheetController | 28 @implementation AutoFillCreditCardSheetController |
29 | 29 |
30 @synthesize creditCardModel = creditCardModel_; | 30 @synthesize creditCardModel = creditCardModel_; |
31 @synthesize expirationMonthContents = expirationMonthContents_; | 31 @synthesize expirationMonthContents = expirationMonthContents_; |
32 @synthesize expirationYearContents = expirationYearContents_; | 32 @synthesize expirationYearContents = expirationYearContents_; |
33 | 33 |
34 - (id)initWithCreditCard:(const CreditCard&)creditCard | 34 - (id)initWithCreditCard:(const CreditCard&)creditCard |
35 mode:(AutoFillCreditCardMode)mode { | 35 mode:(AutoFillCreditCardMode)mode { |
36 NSString* nibPath = [mac_util::MainAppBundle() | 36 NSString* nibPath = [base::mac::MainAppBundle() |
37 pathForResource:@"AutoFillCreditCardSheet" | 37 pathForResource:@"AutoFillCreditCardSheet" |
38 ofType:@"nib"]; | 38 ofType:@"nib"]; |
39 self = [super initWithWindowNibPath:nibPath owner:self]; | 39 self = [super initWithWindowNibPath:nibPath owner:self]; |
40 if (self) { | 40 if (self) { |
41 // Create the model. We use setter here for KVO. | 41 // Create the model. We use setter here for KVO. |
42 [self setCreditCardModel:[[[AutoFillCreditCardModel alloc] | 42 [self setCreditCardModel:[[[AutoFillCreditCardModel alloc] |
43 initWithCreditCard:creditCard] autorelease]]; | 43 initWithCreditCard:creditCard] autorelease]]; |
44 | 44 |
45 mode_ = mode; | 45 mode_ = mode; |
46 } | 46 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 indexOfObject:[creditCardModel_ expirationYear]] == NSNotFound) { | 129 indexOfObject:[creditCardModel_ expirationYear]] == NSNotFound) { |
130 [creditCardModel_ setExpirationYear:@" "]; | 130 [creditCardModel_ setExpirationYear:@" "]; |
131 } | 131 } |
132 | 132 |
133 // Disable first item in menu. @" " is a non-item. | 133 // Disable first item in menu. @" " is a non-item. |
134 [[expirationYearPopup_ itemAtIndex:0] setEnabled:NO]; | 134 [[expirationYearPopup_ itemAtIndex:0] setEnabled:NO]; |
135 } | 135 } |
136 | 136 |
137 @end | 137 @end |
138 | 138 |
OLD | NEW |