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 web_modal::WebContentsModalDialogManager* manager = |
145 ->ShowModalDialog(widget->GetNativeWindow()); | 145 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| 146 manager->ShowModalDialog(widget->GetNativeWindow()); |
146 return widget; | 147 return widget; |
147 } | 148 } |
148 | 149 |
149 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, | 150 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, |
150 content::WebContents* web_contents) { | 151 content::WebContents* web_contents) { |
151 DCHECK_EQ(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); | 152 DCHECK_EQ(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); |
152 return views::DialogDelegate::CreateDialogWidget( | 153 return views::DialogDelegate::CreateDialogWidget( |
153 dialog, nullptr, | 154 dialog, nullptr, |
154 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) | 155 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents) |
155 ->delegate() | 156 ->delegate() |
(...skipping 29 matching lines...) Expand all Loading... |
185 if (host) { | 186 if (host) { |
186 DCHECK_EQ(parent_view, host->GetHostView()); | 187 DCHECK_EQ(parent_view, host->GetHostView()); |
187 ModalDialogHostObserver* dialog_host_observer = | 188 ModalDialogHostObserver* dialog_host_observer = |
188 new WidgetModalDialogHostObserverViews( | 189 new WidgetModalDialogHostObserverViews( |
189 host, widget, kWidgetModalDialogHostObserverViewsKey); | 190 host, widget, kWidgetModalDialogHostObserverViewsKey); |
190 dialog_host_observer->OnPositionRequiresUpdate(); | 191 dialog_host_observer->OnPositionRequiresUpdate(); |
191 } | 192 } |
192 return widget; | 193 return widget; |
193 } | 194 } |
194 | 195 |
195 } // namespace constrained window | 196 } // namespace constrained_window |
OLD | NEW |