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