OLD | NEW |
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 "ui/views/cocoa/views_nswindow_delegate.h" | 5 #import "ui/views/cocoa/views_nswindow_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "ui/views/cocoa/bridged_content_view.h" | 8 #import "ui/views/cocoa/bridged_content_view.h" |
9 #import "ui/views/cocoa/bridged_native_widget.h" | 9 #import "ui/views/cocoa/bridged_native_widget.h" |
10 #include "ui/views/widget/native_widget_mac.h" | 10 #include "ui/views/widget/native_widget_mac.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Allow non-resizable windows (without NSResizableWindowMask) to fill the | 123 // Allow non-resizable windows (without NSResizableWindowMask) to fill the |
124 // screen in fullscreen mode. This only happens when | 124 // screen in fullscreen mode. This only happens when |
125 // -[NSWindow toggleFullscreen:] is called since non-resizable windows have no | 125 // -[NSWindow toggleFullscreen:] is called since non-resizable windows have no |
126 // fullscreen button. Without this they would only enter fullscreen at their | 126 // fullscreen button. Without this they would only enter fullscreen at their |
127 // current size. | 127 // current size. |
128 - (NSSize)window:(NSWindow*)window | 128 - (NSSize)window:(NSWindow*)window |
129 willUseFullScreenContentSize:(NSSize)proposedSize { | 129 willUseFullScreenContentSize:(NSSize)proposedSize { |
130 return proposedSize; | 130 return proposedSize; |
131 } | 131 } |
132 | 132 |
| 133 // Override to correctly position modal dialogs. |
| 134 - (NSRect)window:(NSWindow*)window |
| 135 willPositionSheet:(NSWindow*)sheet |
| 136 usingRect:(NSRect)defaultSheetLocation { |
| 137 // As per NSWindowDelegate documentation, the origin indicates the top left |
| 138 // point of the host frame in window coordinates. The width changes the |
| 139 // animation from vertical to trapezoid if it is smaller than the width of the |
| 140 // dialog. The height is ignored but should be set to zero. |
| 141 return NSMakeRect(0, [self nativeWidgetMac]->SheetPositionY(), |
| 142 NSWidth(defaultSheetLocation), 0); |
| 143 } |
| 144 |
133 @end | 145 @end |
OLD | NEW |