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 "base/debug/alias.h" |
| 10 #include "base/debug/stack_trace.h" |
9 #include "components/constrained_window/constrained_window_views_client.h" | 11 #include "components/constrained_window/constrained_window_views_client.h" |
10 #include "components/guest_view/browser/guest_view_base.h" | 12 #include "components/guest_view/browser/guest_view_base.h" |
11 #include "components/web_modal/web_contents_modal_dialog_host.h" | 13 #include "components/web_modal/web_contents_modal_dialog_host.h" |
12 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 14 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
13 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 15 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
14 #include "ui/views/border.h" | 16 #include "ui/views/border.h" |
15 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
16 #include "ui/views/widget/widget_observer.h" | 18 #include "ui/views/widget/widget_observer.h" |
17 #include "ui/views/window/dialog_delegate.h" | 19 #include "ui/views/window/dialog_delegate.h" |
18 | 20 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 content::WebContents* web_contents = | 141 content::WebContents* web_contents = |
140 guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents); | 142 guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents); |
141 views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents); | 143 views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents); |
142 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) | 144 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) |
143 ->ShowModalDialog(widget->GetNativeWindow()); | 145 ->ShowModalDialog(widget->GetNativeWindow()); |
144 return widget; | 146 return widget; |
145 } | 147 } |
146 | 148 |
147 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, | 149 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, |
148 content::WebContents* web_contents) { | 150 content::WebContents* web_contents) { |
| 151 // Temporary to track down http://crbug.com/538612 |
| 152 base::debug::StackTrace contents_stack_trace = web_contents->stack_trace(); |
| 153 base::debug::Alias(&contents_stack_trace); |
| 154 CHECK( |
| 155 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents)); |
| 156 |
149 DCHECK_EQ(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); | 157 DCHECK_EQ(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); |
150 return views::DialogDelegate::CreateDialogWidget( | 158 return views::DialogDelegate::CreateDialogWidget( |
151 dialog, nullptr, | 159 dialog, nullptr, |
152 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) | 160 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) |
153 ->delegate() | 161 ->delegate() |
154 ->GetWebContentsModalDialogHost() | 162 ->GetWebContentsModalDialogHost() |
155 ->GetHostView()); | 163 ->GetHostView()); |
156 } | 164 } |
157 | 165 |
158 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, | 166 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, |
(...skipping 25 matching lines...) Expand all Loading... |
184 DCHECK_EQ(parent_view, host->GetHostView()); | 192 DCHECK_EQ(parent_view, host->GetHostView()); |
185 ModalDialogHostObserver* dialog_host_observer = | 193 ModalDialogHostObserver* dialog_host_observer = |
186 new WidgetModalDialogHostObserverViews( | 194 new WidgetModalDialogHostObserverViews( |
187 host, widget, kWidgetModalDialogHostObserverViewsKey); | 195 host, widget, kWidgetModalDialogHostObserverViewsKey); |
188 dialog_host_observer->OnPositionRequiresUpdate(); | 196 dialog_host_observer->OnPositionRequiresUpdate(); |
189 } | 197 } |
190 return widget; | 198 return widget; |
191 } | 199 } |
192 | 200 |
193 } // namespace constrained window | 201 } // namespace constrained window |
OLD | NEW |