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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" 5 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h"
6 6
7 #include "chrome/browser/ui/chrome_style.h"
8 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
9 #include "base/memory/scoped_nsobject.h" 8 #include "base/memory/scoped_nsobject.h"
9 #include "chrome/browser/ui/chrome_style.h"
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
11 #include "chrome/browser/ui/chrome_style.h" 11 #include "chrome/browser/ui/chrome_style.h"
12 #include "chrome/browser/ui/chrome_style.h" 12 #include "chrome/browser/ui/chrome_style.h"
13 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h"
13 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" 14 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h"
14 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h" 15 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h"
15 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
16 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" 17 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h"
18 #include "ui/base/cocoa/window_size_constants.h"
17 19
18 namespace autofill { 20 namespace autofill {
19 21
20 // static 22 // static
21 AutofillDialogView* AutofillDialogView::Create( 23 AutofillDialogView* AutofillDialogView::Create(
22 AutofillDialogController* controller) { 24 AutofillDialogController* controller) {
23 return new AutofillDialogCocoa(controller); 25 return new AutofillDialogCocoa(controller);
24 } 26 }
25 27
26 AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogController* controller) 28 AutofillDialogCocoa::AutofillDialogCocoa(AutofillDialogController* controller)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } // autofill 107 } // autofill
106 108
107 #pragma mark Window Controller 109 #pragma mark Window Controller
108 110
109 @implementation AutofillDialogWindowController 111 @implementation AutofillDialogWindowController
110 112
111 - (id)initWithWebContents:(content::WebContents*)webContents 113 - (id)initWithWebContents:(content::WebContents*)webContents
112 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog { 114 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog {
113 DCHECK(webContents); 115 DCHECK(webContents);
114 116
115 // TODO(groby): Should be ui::kWindowSizeDeterminedLater
116 NSRect frame = NSMakeRect(0, 0, 550, 600);
117 scoped_nsobject<ConstrainedWindowCustomWindow> window( 117 scoped_nsobject<ConstrainedWindowCustomWindow> window(
118 [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame]); 118 [[ConstrainedWindowCustomWindow alloc]
119 initWithContentRect:ui::kWindowSizeDeterminedLater]);
119 120
120 if ((self = [super initWithWindow:window])) { 121 if ((self = [super initWithWindow:window])) {
121 webContents_ = webContents; 122 webContents_ = webContents;
122 autofillDialog_ = autofillDialog; 123 autofillDialog_ = autofillDialog;
123 124
124 NSRect clientFrame = NSInsetRect(
125 frame, chrome_style::kHorizontalPadding, 0);
126 clientFrame.size.height -= chrome_style::kTitleTopPadding +
127 chrome_style::kClientBottomPadding;
128 clientFrame.origin.y = chrome_style::kClientBottomPadding;
129 mainContainer_.reset([[AutofillMainContainer alloc] 125 mainContainer_.reset([[AutofillMainContainer alloc]
130 initWithController:autofillDialog->controller()]); 126 initWithController:autofillDialog->controller()]);
131 [mainContainer_ setTarget:self]; 127 [mainContainer_ setTarget:self];
132 [[mainContainer_ view] setFrame:clientFrame];
133 128
134 signInContainer_.reset( 129 signInContainer_.reset(
135 [[AutofillSignInContainer alloc] 130 [[AutofillSignInContainer alloc]
136 initWithController:autofillDialog->controller()]); 131 initWithController:autofillDialog->controller()]);
137 [[signInContainer_ view] setHidden:YES]; 132 [[signInContainer_ view] setHidden:YES];
138 [[signInContainer_ view] setFrame:clientFrame];
139 133
134 NSRect clientRect = [[mainContainer_ view] frame];
135 clientRect.origin = NSMakePoint(chrome_style::kClientBottomPadding,
136 chrome_style::kHorizontalPadding);
137 [[mainContainer_ view] setFrame:clientRect];
138 [[signInContainer_ view] setFrame:clientRect];
140 [[[self window] contentView] setSubviews: 139 [[[self window] contentView] setSubviews:
141 @[[mainContainer_ view], [signInContainer_ view]]]; 140 @[[mainContainer_ view], [signInContainer_ view]]];
141
142 NSRect contentRect = clientRect;
143 contentRect.origin = NSMakePoint(0, 0);
144 contentRect.size.width += 2 * chrome_style::kHorizontalPadding;
145 contentRect.size.height += chrome_style::kClientBottomPadding +
146 chrome_style::kTitleTopPadding;
147 [[[self window] contentView] setFrame:contentRect];
148 NSRect frame = [[self window] frameRectForContentRect:contentRect];
149 [[self window] setFrame:frame display:YES];
142 } 150 }
143 return self; 151 return self;
144 } 152 }
145 153
146 - (void)updateAccountChooser { 154 - (void)updateAccountChooser {
147 [[mainContainer_ accountChooser] update]; 155 [[mainContainer_ accountChooser] update];
148 } 156 }
149 157
150 - (content::NavigationController*)showSignIn { 158 - (content::NavigationController*)showSignIn {
151 [signInContainer_ loadSignInPage]; 159 [signInContainer_ loadSignInPage];
152 [[mainContainer_ view] setHidden:YES]; 160 [[mainContainer_ view] setHidden:YES];
153 [[signInContainer_ view] setHidden:NO]; 161 [[signInContainer_ view] setHidden:NO];
154 162
155 return [signInContainer_ navigationController]; 163 return [signInContainer_ navigationController];
156 } 164 }
157 165
158 - (void)hideSignIn { 166 - (void)hideSignIn {
159 [[signInContainer_ view] setHidden:YES]; 167 [[signInContainer_ view] setHidden:YES];
160 [[mainContainer_ view] setHidden:NO]; 168 [[mainContainer_ view] setHidden:NO];
161 } 169 }
162 170
163 171
164 - (IBAction)closeSheet:(id)sender { 172 - (IBAction)closeSheet:(id)sender {
165 autofillDialog_->PerformClose(); 173 autofillDialog_->PerformClose();
166 } 174 }
167 175
168 @end 176 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698