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

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

Issue 2415053002: MacViews: Support ui::MODAL_TYPE_WINDOW with a null parent window. (Closed)
Patch Set: review comments, desktop widgets, cite bug Created 4 years, 2 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
« no previous file with comments | « components/constrained_window/constrained_window_views_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8ddf80139c21577cc32d25d36eae81f0bf440151..9f26789a2f15a3048e36d78eeb32a2799a5f996a 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -96,8 +96,9 @@ BridgedNativeWidget* NativeWidgetMac::GetBridgeForNativeWindow(
}
bool NativeWidgetMac::IsWindowModalSheet() const {
- return GetWidget()->widget_delegate()->GetModalType() ==
- ui::MODAL_TYPE_WINDOW;
+ return bridge_ && bridge_->parent() &&
+ GetWidget()->widget_delegate()->GetModalType() ==
+ ui::MODAL_TYPE_WINDOW;
}
void NativeWidgetMac::OnWindowWillClose() {
@@ -292,8 +293,13 @@ void NativeWidgetMac::InitModalType(ui::ModalType modal_type) {
// System modal windows not implemented (or used) on Mac.
DCHECK_NE(ui::MODAL_TYPE_SYSTEM, modal_type);
- DCHECK(bridge_->parent());
- // Everyhing happens upon show.
+
+ // A peculiarity of the constrained window framework is that it permits a
+ // dialog of MODAL_TYPE_WINDOW to have a null parent window; falling back to
+ // a non-modal window in this case.
+ DCHECK(bridge_->parent() || modal_type == ui::MODAL_TYPE_WINDOW);
+
+ // Everything happens upon show.
}
gfx::Rect NativeWidgetMac::GetWindowBoundsInScreen() const {
« no previous file with comments | « components/constrained_window/constrained_window_views_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698