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

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: 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } // autofill 104 } // autofill
103 105
104 #pragma mark Window Controller 106 #pragma mark Window Controller
105 107
106 @implementation AutofillDialogWindowController 108 @implementation AutofillDialogWindowController
107 109
108 - (id)initWithWebContents:(content::WebContents*)webContents 110 - (id)initWithWebContents:(content::WebContents*)webContents
109 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog { 111 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog {
110 DCHECK(webContents); 112 DCHECK(webContents);
111 113
112 // TODO(groby): Should be ui::kWindowSizeDeterminedLater
113 NSRect frame = NSMakeRect(0, 0, 550, 600);
114 scoped_nsobject<ConstrainedWindowCustomWindow> window( 114 scoped_nsobject<ConstrainedWindowCustomWindow> window(
115 [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame]); 115 [[ConstrainedWindowCustomWindow alloc]
116 initWithContentRect:ui::kWindowSizeDeterminedLater]);
116 117
117 if ((self = [super initWithWindow:window])) { 118 if ((self = [super initWithWindow:window])) {
118 webContents_ = webContents; 119 webContents_ = webContents;
119 autofillDialog_ = autofillDialog; 120 autofillDialog_ = autofillDialog;
120 121
121 NSRect clientFrame = NSInsetRect(
122 frame, chrome_style::kHorizontalPadding, 0);
123 clientFrame.size.height -= chrome_style::kTitleTopPadding +
124 chrome_style::kClientBottomPadding;
125 clientFrame.origin.y = chrome_style::kClientBottomPadding;
126 mainContainer_.reset([[AutofillMainContainer alloc] 122 mainContainer_.reset([[AutofillMainContainer alloc]
127 initWithController:autofillDialog->controller()]); 123 initWithController:autofillDialog->controller()]);
128 [mainContainer_ setTarget:self]; 124 [mainContainer_ setTarget:self];
129 [[mainContainer_ view] setFrame:clientFrame];
130 125
131 signInContainer_.reset( 126 signInContainer_.reset(
132 [[AutofillSignInContainer alloc] 127 [[AutofillSignInContainer alloc]
133 initWithController:autofillDialog->controller()]); 128 initWithController:autofillDialog->controller()]);
134 [[signInContainer_ view] setHidden:YES]; 129 [[signInContainer_ view] setHidden:YES];
135 [[signInContainer_ view] setFrame:clientFrame]; 130
131 NSRect clientRect = [[mainContainer_ view] frame];
132 clientRect.origin = NSMakePoint(chrome_style::kClientBottomPadding,
133 chrome_style::kHorizontalPadding);
134 NSRect contentRect = clientRect;
sail 2013/05/01 17:12:36 move this closer to where it's used?
groby-ooo-7-16 2013/05/01 20:37:44 Done.
135 contentRect.origin = NSMakePoint(0, 0);
136 contentRect.size.width += 2 * chrome_style::kHorizontalPadding;
137 contentRect.size.height += chrome_style::kClientBottomPadding +
138 chrome_style::kTitleTopPadding;
139 [[mainContainer_ view] setFrame:clientRect];
140 [[signInContainer_ view] setFrame:clientRect];
136 141
137 [[[self window] contentView] setSubviews: 142 [[[self window] contentView] setSubviews:
138 @[[mainContainer_ view], [signInContainer_ view]]]; 143 @[[mainContainer_ view], [signInContainer_ view]]];
144 [[[self window] contentView] setFrame:contentRect];
145 NSRect frame = [[self window] frameRectForContentRect:contentRect];
146 [[self window] setFrame:frame display:YES];
139 } 147 }
140 return self; 148 return self;
141 } 149 }
142 150
143 - (void)updateAccountChooser { 151 - (void)updateAccountChooser {
144 [[mainContainer_ accountChooser] update]; 152 [[mainContainer_ accountChooser] update];
145 } 153 }
146 154
147 - (content::NavigationController*)showSignIn { 155 - (content::NavigationController*)showSignIn {
148 [signInContainer_ loadSignInPage]; 156 [signInContainer_ loadSignInPage];
149 [[mainContainer_ view] setHidden:YES]; 157 [[mainContainer_ view] setHidden:YES];
150 [[signInContainer_ view] setHidden:NO]; 158 [[signInContainer_ view] setHidden:NO];
151 159
152 return [signInContainer_ navigationController]; 160 return [signInContainer_ navigationController];
153 } 161 }
154 162
155 - (void)hideSignIn { 163 - (void)hideSignIn {
156 [[signInContainer_ view] setHidden:YES]; 164 [[signInContainer_ view] setHidden:YES];
157 [[mainContainer_ view] setHidden:NO]; 165 [[mainContainer_ view] setHidden:NO];
158 } 166 }
159 167
160 168
161 - (IBAction)closeSheet:(id)sender { 169 - (IBAction)closeSheet:(id)sender {
162 autofillDialog_->PerformClose(); 170 autofillDialog_->PerformClose();
163 } 171 }
164 172
165 @end 173 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698