| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 web_modal::PopupManager::FromWebContents(web_contents); | 140 web_modal::PopupManager::FromWebContents(web_contents); |
| 141 popup_manager->ShowModalDialog(widget->GetNativeWindow(), web_contents); | 141 popup_manager->ShowModalDialog(widget->GetNativeWindow(), web_contents); |
| 142 return widget; | 142 return widget; |
| 143 } | 143 } |
| 144 | 144 |
| 145 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, | 145 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, |
| 146 content::WebContents* web_contents) { | 146 content::WebContents* web_contents) { |
| 147 DCHECK_EQ(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); | 147 DCHECK_EQ(ui::MODAL_TYPE_CHILD, dialog->GetModalType()); |
| 148 web_modal::PopupManager* popup_manager = | 148 web_modal::PopupManager* popup_manager = |
| 149 web_modal::PopupManager::FromWebContents(web_contents); | 149 web_modal::PopupManager::FromWebContents(web_contents); |
| 150 const gfx::NativeWindow parent = popup_manager->GetHostView(); | 150 const gfx::NativeView parent = popup_manager->GetHostView(); |
| 151 return views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent); | 151 return views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent); |
| 152 } | 152 } |
| 153 | 153 |
| 154 // TODO(gbillock): Replace this with PopupManager calls. | 154 // TODO(gbillock): Replace this with PopupManager calls. |
| 155 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, | 155 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, |
| 156 gfx::NativeWindow parent) { | 156 gfx::NativeView parent) { |
| 157 views::Widget* widget = | 157 views::Widget* widget = |
| 158 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent); | 158 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent); |
| 159 if (!dialog->UseNewStyleForThisDialog()) | 159 if (!dialog->UseNewStyleForThisDialog()) |
| 160 return widget; | 160 return widget; |
| 161 DCHECK(constrained_window_views_client); | 161 DCHECK(constrained_window_views_client); |
| 162 ModalDialogHost* host = constrained_window_views_client-> | 162 ModalDialogHost* host = constrained_window_views_client-> |
| 163 GetModalDialogHost(parent); | 163 GetModalDialogHost(parent); |
| 164 if (host) { | 164 if (host) { |
| 165 DCHECK_EQ(parent, host->GetHostView()); | 165 DCHECK_EQ(parent, host->GetHostView()); |
| 166 ModalDialogHostObserver* dialog_host_observer = | 166 ModalDialogHostObserver* dialog_host_observer = |
| 167 new WidgetModalDialogHostObserverViews( | 167 new WidgetModalDialogHostObserverViews( |
| 168 host, widget, kWidgetModalDialogHostObserverViewsKey); | 168 host, widget, kWidgetModalDialogHostObserverViewsKey); |
| 169 dialog_host_observer->OnPositionRequiresUpdate(); | 169 dialog_host_observer->OnPositionRequiresUpdate(); |
| 170 } | 170 } |
| 171 return widget; | 171 return widget; |
| 172 } | 172 } |
| OLD | NEW |