OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "components/constrained_window/constrained_window_views.h" | 5 #include "components/constrained_window/constrained_window_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "components/constrained_window/constrained_window_views_client.h" | 9 #include "components/constrained_window/constrained_window_views_client.h" |
10 #include "components/guest_view/browser/guest_view_base.h" | 10 #include "components/guest_view/browser/guest_view_base.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 gfx::NativeWindow parent) { | 159 gfx::NativeWindow parent) { |
160 DCHECK_NE(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); | 160 DCHECK_NE(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); |
161 DCHECK_NE(ui::MODAL_TYPE_NONE, dialog->GetModalType()); | 161 DCHECK_NE(ui::MODAL_TYPE_NONE, dialog->GetModalType()); |
162 | 162 |
163 DCHECK(constrained_window_views_client); | 163 DCHECK(constrained_window_views_client); |
164 gfx::NativeView parent_view = | 164 gfx::NativeView parent_view = |
165 parent ? constrained_window_views_client->GetDialogHostView(parent) | 165 parent ? constrained_window_views_client->GetDialogHostView(parent) |
166 : nullptr; | 166 : nullptr; |
167 views::Widget* widget = | 167 views::Widget* widget = |
168 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent_view); | 168 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent_view); |
169 | |
170 #if defined(OS_MACOSX) | |
171 // On Mac, window modal dialogs are displayed as sheets, so their position is | |
172 // managed by the parent window. | |
173 return widget; | |
tapted
2015/08/21 00:31:52
I know the compiler allows it.. but there's someth
jackhou1
2015/08/21 01:55:58
Replied in https://codereview.chromium.org/1309583
| |
174 #endif | |
175 | |
169 if (!dialog->UseNewStyleForThisDialog()) | 176 if (!dialog->UseNewStyleForThisDialog()) |
170 return widget; | 177 return widget; |
171 ModalDialogHost* host = constrained_window_views_client-> | 178 ModalDialogHost* host = constrained_window_views_client-> |
172 GetModalDialogHost(parent); | 179 GetModalDialogHost(parent); |
173 if (host) { | 180 if (host) { |
174 DCHECK_EQ(parent_view, host->GetHostView()); | 181 DCHECK_EQ(parent_view, host->GetHostView()); |
175 ModalDialogHostObserver* dialog_host_observer = | 182 ModalDialogHostObserver* dialog_host_observer = |
176 new WidgetModalDialogHostObserverViews( | 183 new WidgetModalDialogHostObserverViews( |
177 host, widget, kWidgetModalDialogHostObserverViewsKey); | 184 host, widget, kWidgetModalDialogHostObserverViewsKey); |
178 dialog_host_observer->OnPositionRequiresUpdate(); | 185 dialog_host_observer->OnPositionRequiresUpdate(); |
179 } | 186 } |
180 return widget; | 187 return widget; |
181 } | 188 } |
182 | 189 |
183 } // namespace constrained window | 190 } // namespace constrained window |
OLD | NEW |