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

Side by Side Diff: chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_views_mac.mm

Issue 1430023002: Enable AutoResize for Constrained Web Dialogs for Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per erikchen@'s comments. Created 5 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/web_contents_modal_dialog_manager_views_mac.h" 5 #import "chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_views_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/foundation_util.h" 9 #import "base/mac/foundation_util.h"
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 - (void)updateSheetPosition { 91 - (void)updateSheetPosition {
92 ConstrainedWindowSheetController* controller = 92 ConstrainedWindowSheetController* controller =
93 [ConstrainedWindowSheetController controllerForSheet:self]; 93 [ConstrainedWindowSheetController controllerForSheet:self];
94 NSPoint origin = [controller originForSheet:self 94 NSPoint origin = [controller originForSheet:self
95 withWindowSize:[customWindow_ frame].size]; 95 withWindowSize:[customWindow_ frame].size];
96 [customWindow_ setFrameOrigin:origin]; 96 [customWindow_ setFrameOrigin:origin];
97 } 97 }
98 98
99 - (void)resizeWithNewSize:(NSSize)size {
100 // NOOP
101 }
102
99 - (NSWindow*)sheetWindow { 103 - (NSWindow*)sheetWindow {
100 return customWindow_; 104 return customWindow_;
101 } 105 }
102 106
103 @end 107 @end
104 108
105 SingleWebContentsDialogManagerViewsMac::SingleWebContentsDialogManagerViewsMac( 109 SingleWebContentsDialogManagerViewsMac::SingleWebContentsDialogManagerViewsMac(
106 NSWindow* dialog, 110 NSWindow* dialog,
107 web_modal::SingleWebContentsDialogManagerDelegate* delegate) 111 web_modal::SingleWebContentsDialogManagerDelegate* delegate)
108 : delegate_(delegate), host_(nullptr) { 112 : delegate_(delegate), host_(nullptr) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 188
185 void SingleWebContentsDialogManagerViewsMac::OnWidgetDestroying( 189 void SingleWebContentsDialogManagerViewsMac::OnWidgetDestroying(
186 views::Widget* widget) { 190 views::Widget* widget) {
187 // On Mac, this would only be reached if something called -[NSWindow close] 191 // On Mac, this would only be reached if something called -[NSWindow close]
188 // on the dialog without going through Widget::Close or CloseNow(). Since 192 // on the dialog without going through Widget::Close or CloseNow(). Since
189 // dialogs have no titlebar, it won't come from the system. If something 193 // dialogs have no titlebar, it won't come from the system. If something
190 // internally calls -[NSWindow close] it might break lifetime assumptions 194 // internally calls -[NSWindow close] it might break lifetime assumptions
191 // made by DialogDelegate. 195 // made by DialogDelegate.
192 NOTREACHED(); 196 NOTREACHED();
193 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698