| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 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 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
| 6 |
| 7 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| 8 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
| 9 |
| 10 @implementation AutofillDetailsContainer |
| 11 |
| 12 - (id)initWithController:(autofill::AutofillDialogController*)controller { |
| 13 if (self = [super init]) { |
| 14 controller_ = controller; |
| 15 } |
| 16 return self; |
| 17 } |
| 18 |
| 19 - (void)addSection:(autofill::DialogSection)section { |
| 20 scoped_nsobject<AutofillSectionContainer> sectionContainer; |
| 21 sectionContainer.reset( |
| 22 [[AutofillSectionContainer alloc] initWithController:controller_ |
| 23 forSection:section]); |
| 24 [details_ addObject:sectionContainer]; |
| 25 } |
| 26 |
| 27 - (void)loadView { |
| 28 details_.reset([[NSMutableArray alloc] init]); |
| 29 |
| 30 [self addSection:autofill::SECTION_EMAIL]; |
| 31 [self addSection:autofill::SECTION_CC]; |
| 32 [self addSection:autofill::SECTION_BILLING]; |
| 33 // TODO(groby): Add SECTION_CC_BILLING once toggling is enabled. |
| 34 [self addSection:autofill::SECTION_SHIPPING]; |
| 35 |
| 36 [self setView:[[NSView alloc] init]]; |
| 37 |
| 38 NSRect rect = NSZeroRect; |
| 39 for(AutofillSectionContainer* container in |
| 40 [details_ reverseObjectEnumerator]) { |
| 41 [[container view] setFrameOrigin:NSMakePoint(0, NSMaxY(rect))]; |
| 42 rect = NSUnionRect(rect, [[container view] frame]); |
| 43 [[self view] addSubview:[container view]]; |
| 44 } |
| 45 [[self view] setFrame:rect]; |
| 46 } |
| 47 |
| 48 @end |
| OLD | NEW |