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

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

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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 "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/memory/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
10 #include "chrome/browser/ui/chrome_style.h" 10 #include "chrome/browser/ui/chrome_style.h"
11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
12 #include "chrome/browser/ui/chrome_style.h" 11 #include "chrome/browser/ui/chrome_style.h"
13 #include "chrome/browser/ui/chrome_style.h" 12 #include "chrome/browser/ui/chrome_style.h"
14 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h" 13 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h"
15 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" 14 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h"
16 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" 15 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h"
17 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" 16 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
18 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h" 17 #import "chrome/browser/ui/cocoa/autofill/autofill_sign_in_container.h"
18 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
19 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 19 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
20 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h" 20 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi ndow.h"
21 #import "ui/base/cocoa/flipped_view.h" 21 #import "ui/base/cocoa/flipped_view.h"
22 #include "ui/base/cocoa/window_size_constants.h" 22 #include "ui/base/cocoa/window_size_constants.h"
23 23
24 namespace { 24 namespace {
25 25
26 const CGFloat kAccountChooserHeight = 20.0; 26 const CGFloat kAccountChooserHeight = 20.0;
27 const CGFloat kRelatedControlVerticalSpacing = 8.0; 27 const CGFloat kRelatedControlVerticalSpacing = 8.0;
28 28
(...skipping 13 matching lines...) Expand all
42 42
43 AutofillDialogCocoa::~AutofillDialogCocoa() { 43 AutofillDialogCocoa::~AutofillDialogCocoa() {
44 } 44 }
45 45
46 void AutofillDialogCocoa::Show() { 46 void AutofillDialogCocoa::Show() {
47 // This should only be called once. 47 // This should only be called once.
48 DCHECK(!sheet_controller_.get()); 48 DCHECK(!sheet_controller_.get());
49 sheet_controller_.reset([[AutofillDialogWindowController alloc] 49 sheet_controller_.reset([[AutofillDialogWindowController alloc]
50 initWithWebContents:controller_->web_contents() 50 initWithWebContents:controller_->web_contents()
51 autofillDialog:this]); 51 autofillDialog:this]);
52 scoped_nsobject<CustomConstrainedWindowSheet> sheet( 52 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet(
53 [[CustomConstrainedWindowSheet alloc] 53 [[CustomConstrainedWindowSheet alloc]
54 initWithCustomWindow:[sheet_controller_ window]]); 54 initWithCustomWindow:[sheet_controller_ window]]);
55 constrained_window_.reset( 55 constrained_window_.reset(
56 new ConstrainedWindowMac(this, controller_->web_contents(), sheet)); 56 new ConstrainedWindowMac(this, controller_->web_contents(), sheet));
57 } 57 }
58 58
59 // Closes the sheet and ends the modal loop. Triggers cleanup sequence. 59 // Closes the sheet and ends the modal loop. Triggers cleanup sequence.
60 void AutofillDialogCocoa::Hide() { 60 void AutofillDialogCocoa::Hide() {
61 constrained_window_->CloseWebContentsModalDialog(); 61 constrained_window_->CloseWebContentsModalDialog();
62 } 62 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } // autofill 129 } // autofill
130 130
131 #pragma mark Window Controller 131 #pragma mark Window Controller
132 132
133 @implementation AutofillDialogWindowController 133 @implementation AutofillDialogWindowController
134 134
135 - (id)initWithWebContents:(content::WebContents*)webContents 135 - (id)initWithWebContents:(content::WebContents*)webContents
136 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog { 136 autofillDialog:(autofill::AutofillDialogCocoa*)autofillDialog {
137 DCHECK(webContents); 137 DCHECK(webContents);
138 138
139 scoped_nsobject<ConstrainedWindowCustomWindow> window( 139 base::scoped_nsobject<ConstrainedWindowCustomWindow> window(
140 [[ConstrainedWindowCustomWindow alloc] 140 [[ConstrainedWindowCustomWindow alloc]
141 initWithContentRect:ui::kWindowSizeDeterminedLater]); 141 initWithContentRect:ui::kWindowSizeDeterminedLater]);
142 142
143 if ((self = [super initWithWindow:window])) { 143 if ((self = [super initWithWindow:window])) {
144 webContents_ = webContents; 144 webContents_ = webContents;
145 autofillDialog_ = autofillDialog; 145 autofillDialog_ = autofillDialog;
146 146
147 mainContainer_.reset([[AutofillMainContainer alloc] 147 mainContainer_.reset([[AutofillMainContainer alloc]
148 initWithController:autofillDialog->controller()]); 148 initWithController:autofillDialog->controller()]);
149 [mainContainer_ setTarget:self]; 149 [mainContainer_ setTarget:self];
(...skipping 12 matching lines...) Expand all
162 NSRect headerRect = clientRect; 162 NSRect headerRect = clientRect;
163 headerRect.size.height = kAccountChooserHeight; 163 headerRect.size.height = kAccountChooserHeight;
164 headerRect.origin.y = NSMaxY(clientRect); 164 headerRect.origin.y = NSMaxY(clientRect);
165 accountChooser_.reset([[AutofillAccountChooser alloc] 165 accountChooser_.reset([[AutofillAccountChooser alloc]
166 initWithFrame:headerRect 166 initWithFrame:headerRect
167 controller:autofillDialog->controller()]); 167 controller:autofillDialog->controller()]);
168 168
169 // This needs a flipped content view because otherwise the size 169 // This needs a flipped content view because otherwise the size
170 // animation looks odd. However, replacing the contentView for constrained 170 // animation looks odd. However, replacing the contentView for constrained
171 // windows does not work - it does custom rendering. 171 // windows does not work - it does custom rendering.
172 scoped_nsobject<NSView> flippedContentView( 172 base::scoped_nsobject<NSView> flippedContentView(
173 [[FlippedView alloc] initWithFrame:NSZeroRect]); 173 [[FlippedView alloc] initWithFrame:NSZeroRect]);
174 [flippedContentView setSubviews: 174 [flippedContentView setSubviews:
175 @[accountChooser_, [mainContainer_ view], [signInContainer_ view]]]; 175 @[accountChooser_, [mainContainer_ view], [signInContainer_ view]]];
176 [flippedContentView setAutoresizingMask: 176 [flippedContentView setAutoresizingMask:
177 (NSViewWidthSizable | NSViewHeightSizable)]; 177 (NSViewWidthSizable | NSViewHeightSizable)];
178 [[[self window] contentView] addSubview:flippedContentView]; 178 [[[self window] contentView] addSubview:flippedContentView];
179 179
180 NSRect contentRect = clientRect; 180 NSRect contentRect = clientRect;
181 contentRect.origin = NSMakePoint(0, 0); 181 contentRect.origin = NSMakePoint(0, 0);
182 contentRect.size.width += 2 * chrome_style::kHorizontalPadding; 182 contentRect.size.width += 2 * chrome_style::kHorizontalPadding;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 [[signInContainer_ view] setHidden:YES]; 274 [[signInContainer_ view] setHidden:YES];
275 [[mainContainer_ view] setHidden:NO]; 275 [[mainContainer_ view] setHidden:NO];
276 [self performLayout]; 276 [self performLayout];
277 } 277 }
278 278
279 - (void)modelChanged { 279 - (void)modelChanged {
280 [mainContainer_ modelChanged]; 280 [mainContainer_ modelChanged];
281 } 281 }
282 282
283 @end 283 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698