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

Unified 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: Fix broken include path. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
new file mode 100644
index 0000000000000000000000000000000000000000..5ae0ebe491fb1fddadf0a4a7b4f941d4ebab9930
--- /dev/null
+++ b/chrome/browser/ui/cocoa/autofill/autofill_details_container.mm
@@ -0,0 +1,47 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h"
+
+#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
+#import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
+
+@implementation AutofillDetailsContainer
+
+- (id)initWithController:(autofill::AutofillDialogController*)controller {
+ if (self = [super init]) {
+ controller_ = controller;
+ }
+ return self;
+}
+
+- (void)addSection:(autofill::DialogSection)section {
+ scoped_nsobject<AutofillSectionContainer> sectionContainer(
+ [[AutofillSectionContainer alloc] initWithController:controller_
+ forSection:section]);
+ [details_ addObject:sectionContainer];
+}
+
+- (void)loadView {
+ details_.reset([[NSMutableArray alloc] init]);
+
+ [self addSection:autofill::SECTION_EMAIL];
+ [self addSection:autofill::SECTION_CC];
+ [self addSection:autofill::SECTION_BILLING];
+ // TODO(groby): Add SECTION_CC_BILLING once toggling is enabled.
+ [self addSection:autofill::SECTION_SHIPPING];
+
+ [self setView:[[NSView alloc] init]];
+
+ NSRect rect = NSZeroRect;
+ for(AutofillSectionContainer* container in
+ [details_ reverseObjectEnumerator]) {
+ [[container view] setFrameOrigin:NSMakePoint(0, NSMaxY(rect))];
+ rect = NSUnionRect(rect, [[container view] frame]);
+ [[self view] addSubview:[container view]];
+ }
+ [[self view] setFrame:rect];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698