Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_details_container.mm

Issue 14704004: [Autofill] Add Details Section (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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(
sail 2013/05/01 17:12:36 move into constructor
groby-ooo-7-16 2013/05/01 20:37:44 I'm confused - I call this several times, so I can
sail 2013/05/01 21:38:38 Oops, sorry. I meant combine declaration and initi
groby-ooo-7-16 2013/05/01 22:36:41 Done.
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 NSSize detailSize;
sail 2013/05/01 17:12:36 need to initialize
groby-ooo-7-16 2013/05/01 20:37:44 Done. Only for my clarification: ObjC style guid
sail 2013/05/01 21:38:38 That only applies to member variables.
37 for(AutofillSectionContainer* container in details_.get()) {
38 detailSize.width = NSWidth([[container view] frame]);
sail 2013/05/01 17:12:36 should this be a max or something?
groby-ooo-7-16 2013/05/01 20:37:44 I was torn here - I only need the width of the fir
39 detailSize.height += NSHeight([[container view] frame]);
40 }
41
42 NSPoint origin = NSMakePoint(0, detailSize.height);
43
44 self.view = [[NSView alloc] init];
sail 2013/05/01 17:12:36 I don't think we should use dot notation (it's pre
groby-ooo-7-16 2013/05/01 20:37:44 Done. If we don't use dot notation, does it make
45 [[self view] setFrameSize:detailSize];
46
47 for(AutofillSectionContainer* container in details_.get()) {
sail 2013/05/01 17:12:36 Alternatively, you could have single loop that ite
groby-ooo-7-16 2013/05/01 20:37:44 TIL: reverseObjectEnumerator - done. On 2013/05/01
48 origin.y -= NSHeight([[container view] frame]);
49 [[container view] setFrameOrigin:origin];
50 [self.view addSubview:[container view]];
51 }
52 }
53
54 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698