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