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/macros.h" | 9 #include "base/macros.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 views::Widget* ShowWebModalDialogViews( | 135 views::Widget* ShowWebModalDialogViews( |
136 views::WidgetDelegate* dialog, | 136 views::WidgetDelegate* dialog, |
137 content::WebContents* initiator_web_contents) { | 137 content::WebContents* initiator_web_contents) { |
138 DCHECK(constrained_window_views_client); | 138 DCHECK(constrained_window_views_client); |
139 // For embedded WebContents, use the embedder's WebContents for constrained | 139 // For embedded WebContents, use the embedder's WebContents for constrained |
140 // window. | 140 // window. |
141 content::WebContents* web_contents = | 141 content::WebContents* web_contents = |
142 guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents); | 142 guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents); |
143 views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents); | 143 views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents); |
144 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) | 144 ShowModalDialog(widget->GetNativeWindow(), web_contents); |
145 ->ShowModalDialog(widget->GetNativeWindow()); | |
146 return widget; | 145 return widget; |
147 } | 146 } |
148 | 147 |
149 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, | 148 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, |
150 content::WebContents* web_contents) { | 149 content::WebContents* web_contents) { |
151 DCHECK_EQ(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); | 150 DCHECK_EQ(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); |
152 return views::DialogDelegate::CreateDialogWidget( | 151 return views::DialogDelegate::CreateDialogWidget( |
153 dialog, nullptr, | 152 dialog, nullptr, |
154 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) | 153 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) |
155 ->delegate() | 154 ->delegate() |
(...skipping 30 matching lines...) Expand all Loading... |
186 DCHECK_EQ(parent_view, host->GetHostView()); | 185 DCHECK_EQ(parent_view, host->GetHostView()); |
187 ModalDialogHostObserver* dialog_host_observer = | 186 ModalDialogHostObserver* dialog_host_observer = |
188 new WidgetModalDialogHostObserverViews( | 187 new WidgetModalDialogHostObserverViews( |
189 host, widget, kWidgetModalDialogHostObserverViewsKey); | 188 host, widget, kWidgetModalDialogHostObserverViewsKey); |
190 dialog_host_observer->OnPositionRequiresUpdate(); | 189 dialog_host_observer->OnPositionRequiresUpdate(); |
191 } | 190 } |
192 return widget; | 191 return widget; |
193 } | 192 } |
194 | 193 |
195 } // namespace constrained window | 194 } // namespace constrained window |
OLD | NEW |