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/web_modal/popup_manager.h" | 10 #include "components/web_modal/popup_manager.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // TODO(gbillock): Replace this with PopupManager calls. | 155 // TODO(gbillock): Replace this with PopupManager calls. |
156 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, | 156 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, |
157 gfx::NativeView parent) { | 157 gfx::NativeView parent) { |
158 DCHECK_NE(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); | 158 DCHECK_NE(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); |
159 DCHECK_NE(ui::MODAL_TYPE_NONE, dialog->GetModalType()); | 159 DCHECK_NE(ui::MODAL_TYPE_NONE, dialog->GetModalType()); |
160 | 160 |
161 views::Widget* widget = | 161 views::Widget* widget = |
162 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent); | 162 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent); |
163 if (!dialog->UseNewStyleForThisDialog()) | 163 if (!dialog->UseNewStyleForThisDialog()) |
164 return widget; | 164 return widget; |
| 165 |
165 DCHECK(constrained_window_views_client); | 166 DCHECK(constrained_window_views_client); |
166 ModalDialogHost* host = constrained_window_views_client-> | 167 ModalDialogHost* host = constrained_window_views_client-> |
167 GetModalDialogHost(parent); | 168 GetModalDialogHost(parent); |
168 if (host) { | 169 if (host) { |
169 DCHECK_EQ(parent, host->GetHostView()); | 170 DCHECK_EQ(parent, host->GetHostView()); |
170 ModalDialogHostObserver* dialog_host_observer = | 171 ModalDialogHostObserver* dialog_host_observer = |
171 new WidgetModalDialogHostObserverViews( | 172 new WidgetModalDialogHostObserverViews( |
172 host, widget, kWidgetModalDialogHostObserverViewsKey); | 173 host, widget, kWidgetModalDialogHostObserverViewsKey); |
173 dialog_host_observer->OnPositionRequiresUpdate(); | 174 dialog_host_observer->OnPositionRequiresUpdate(); |
174 } | 175 } |
175 return widget; | 176 return widget; |
176 } | 177 } |
177 | 178 |
| 179 views::Widget* CreateModalDialogViews(views::DialogDelegate* dialog, |
| 180 web_modal::ModalDialogHost* host) { |
| 181 DCHECK(dialog->UseNewStyleForThisDialog()); |
| 182 DCHECK(host); |
| 183 DCHECK_NE(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); |
| 184 DCHECK_NE(ui::MODAL_TYPE_NONE, dialog->GetModalType()); |
| 185 |
| 186 views::Widget* widget = views::DialogDelegate::CreateDialogWidget( |
| 187 dialog, NULL, host->GetHostView()); |
| 188 |
| 189 ModalDialogHostObserver* dialog_host_observer = |
| 190 new WidgetModalDialogHostObserverViews( |
| 191 host, widget, kWidgetModalDialogHostObserverViewsKey); |
| 192 dialog_host_observer->OnPositionRequiresUpdate(); |
| 193 return widget; |
| 194 } |
| 195 |
178 } // namespace constrained window | 196 } // namespace constrained window |
OLD | NEW |