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

Unified Diff: ui/views/widget/native_widget_mac.mm

Issue 993253002: MacViews: Implement Window-modal dialogs using sheets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update isolate Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/native_widget_mac.mm
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm
index 20db395761ee684482da88635be05860871c89e4..3e4383020924455ce719aeaf10fc0caaa386b31a 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -251,7 +251,13 @@ void NativeWidgetMac::SetWindowIcons(const gfx::ImageSkia& window_icon,
}
void NativeWidgetMac::InitModalType(ui::ModalType modal_type) {
- NOTIMPLEMENTED();
+ if (modal_type == ui::MODAL_TYPE_NONE)
+ return;
+
+ // System modal windows not implemented (or used) on Mac.
+ DCHECK_NE(ui::MODAL_TYPE_SYSTEM, modal_type);
+ DCHECK(bridge_->parent());
+ // Everyhing happens upon show.
}
gfx::Rect NativeWidgetMac::GetWindowBoundsInScreen() const {
@@ -299,6 +305,17 @@ void NativeWidgetMac::Close() {
if (!bridge_)
return;
+ if (delegate_->IsModal()) {
+ // Sheets can't be closed normally. This starts the sheet closing. Once the
+ // sheet has finished animating, it will call sheetDidEnd: on the parent
+ // window's delegate. Note it still needs to be asynchronous, since code
+ // calling Widget::Close() doesn't expect things to be deleted upon return.
+ [NSApp performSelector:@selector(endSheet:)
+ withObject:GetNativeWindow()
+ afterDelay:0];
+ return;
+ }
+
// Clear the view early to suppress repaints.
bridge_->SetRootView(NULL);

Powered by Google App Engine
This is Rietveld 408576698