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_dialog_controller_mac.h" | 5 #import "chrome/browser/autofill/autofill_dialog_controller_mac.h" |
6 #include "app/l10n_util.h" | 6 #include "app/l10n_util.h" |
7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
8 #import "chrome/browser/autofill/autofill_address_model_mac.h" | 8 #import "chrome/browser/autofill/autofill_address_model_mac.h" |
9 #import "chrome/browser/autofill/autofill_address_view_controller_mac.h" | 9 #import "chrome/browser/autofill/autofill_address_view_controller_mac.h" |
10 #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" | 10 #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 [self closeDialog]; | 90 [self closeDialog]; |
91 } | 91 } |
92 | 92 |
93 // Called when the user clicks the cancel button. All we need to do is stop | 93 // Called when the user clicks the cancel button. All we need to do is stop |
94 // the modal session. | 94 // the modal session. |
95 - (IBAction)cancel:(id)sender { | 95 - (IBAction)cancel:(id)sender { |
96 [self closeDialog]; | 96 [self closeDialog]; |
97 } | 97 } |
98 | 98 |
99 // Adds new address to bottom of list. A new address controller is created | 99 // Adds new address to bottom of list. A new address controller is created |
100 // and its view is inserted into the view heirarchy. | 100 // and its view is inserted into the view hierarchy. |
101 - (IBAction)addNewAddress:(id)sender { | 101 - (IBAction)addNewAddress:(id)sender { |
102 // Insert relative to top of section, or below last address. | 102 // Insert relative to top of section, or below last address. |
103 NSView* insertionPoint; | 103 NSView* insertionPoint; |
104 NSUInteger count = [addressFormViewControllers_.get() count]; | 104 NSUInteger count = [addressFormViewControllers_.get() count]; |
105 if (count == 0) { | 105 if (count == 0) { |
106 insertionPoint = addressSection_; | 106 insertionPoint = addressSection_; |
107 } else { | 107 } else { |
108 insertionPoint = [[addressFormViewControllers_.get() | 108 insertionPoint = [[addressFormViewControllers_.get() |
109 objectAtIndex:[addressFormViewControllers_.get() count] - 1] view]; | 109 objectAtIndex:[addressFormViewControllers_.get() count] - 1] view]; |
110 } | 110 } |
(...skipping 14 matching lines...) Expand all Loading... |
125 positioned:NSWindowBelow relativeTo:insertionPoint]; | 125 positioned:NSWindowBelow relativeTo:insertionPoint]; |
126 [[addressViewController view] setFrameOrigin:NSMakePoint(0, 0)]; | 126 [[addressViewController view] setFrameOrigin:NSMakePoint(0, 0)]; |
127 | 127 |
128 [self notifyAddressChange:self]; | 128 [self notifyAddressChange:self]; |
129 | 129 |
130 // Recalculate key view loop to account for change in view tree. | 130 // Recalculate key view loop to account for change in view tree. |
131 [[self window] recalculateKeyViewLoop]; | 131 [[self window] recalculateKeyViewLoop]; |
132 } | 132 } |
133 | 133 |
134 // Adds new credit card to bottom of list. A new credit card controller is | 134 // Adds new credit card to bottom of list. A new credit card controller is |
135 // created and its view is inserted into the view heirarchy. | 135 // created and its view is inserted into the view hierarchy. |
136 - (IBAction)addNewCreditCard:(id)sender { | 136 - (IBAction)addNewCreditCard:(id)sender { |
137 // Insert relative to top of section, or below last address. | 137 // Insert relative to top of section, or below last address. |
138 NSView* insertionPoint; | 138 NSView* insertionPoint; |
139 NSUInteger count = [creditCardFormViewControllers_.get() count]; | 139 NSUInteger count = [creditCardFormViewControllers_.get() count]; |
140 if (count == 0) { | 140 if (count == 0) { |
141 insertionPoint = creditCardSection_; | 141 insertionPoint = creditCardSection_; |
142 } else { | 142 } else { |
143 insertionPoint = [[creditCardFormViewControllers_.get() | 143 insertionPoint = [[creditCardFormViewControllers_.get() |
144 objectAtIndex:[creditCardFormViewControllers_.get() count] - 1] view]; | 144 objectAtIndex:[creditCardFormViewControllers_.get() count] - 1] view]; |
145 } | 145 } |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 // Embed the child view into our (owned by us) target view. | 351 // Embed the child view into our (owned by us) target view. |
352 [childView_ addSubview:[creditCardViewController view] | 352 [childView_ addSubview:[creditCardViewController view] |
353 positioned:NSWindowBelow relativeTo:insertionPoint]; | 353 positioned:NSWindowBelow relativeTo:insertionPoint]; |
354 insertionPoint = [creditCardViewController view]; | 354 insertionPoint = [creditCardViewController view]; |
355 [[creditCardViewController view] setFrameOrigin:NSMakePoint(0, 0)]; | 355 [[creditCardViewController view] setFrameOrigin:NSMakePoint(0, 0)]; |
356 } | 356 } |
357 } | 357 } |
358 | 358 |
359 @end | 359 @end |
OLD | NEW |