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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialog_sheet.mm

Issue 1446623003: [Reland] Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialo g_sheet.h" 5 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_web_dialo g_sheet.h"
6 6
7 #include "ui/gfx/geometry/size.h" 7 #include "ui/gfx/geometry/size.h"
8 #include "ui/web_dialogs/web_dialog_delegate.h" 8 #include "ui/web_dialogs/web_dialog_delegate.h"
9 9
10 @implementation WebDialogConstrainedWindowSheet 10 @implementation WebDialogConstrainedWindowSheet
11 11
12 - (id)initWithCustomWindow:(NSWindow*)customWindow 12 - (id)initWithCustomWindow:(NSWindow*)customWindow
13 webDialogDelegate:(ui::WebDialogDelegate*)delegate { 13 webDialogDelegate:(ui::WebDialogDelegate*)delegate {
14 if (self = [super initWithCustomWindow:customWindow]) { 14 if (self = [super initWithCustomWindow:customWindow]) {
15 web_dialog_delegate_ = delegate; 15 web_dialog_delegate_ = delegate;
16 } 16 }
17 17
18 return self; 18 return self;
19 } 19 }
20 20
21 - (void)updateSheetPosition { 21 - (void)updateSheetPosition {
22 if (web_dialog_delegate_) { 22 if (web_dialog_delegate_) {
23 gfx::Size size; 23 gfx::Size size;
24 web_dialog_delegate_->GetDialogSize(&size); 24 web_dialog_delegate_->GetDialogSize(&size);
25 [customWindow_ setContentSize:NSMakeSize(size.width(), size.height())]; 25 [customWindow_ setContentSize:NSMakeSize(size.width(), size.height())];
26 } 26 }
27 [super updateSheetPosition]; 27 [super updateSheetPosition];
28 } 28 }
29 29
30 - (void)resizeWithNewSize:(NSSize)size {
31 [customWindow_ setContentSize:size];
32
33 // self's updateSheetPosition() sets |customWindow_|'s contentSize to a
34 // fixed dialog size. Here, we want to resize to |size| instead. Use
35 // super rather than self to bypass the setContentSize() call for the fixed
36 // size.
37 [super updateSheetPosition];
38 }
39
30 @end 40 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698