| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "components/constrained_window/constrained_window_views.h" | 7 #include "components/constrained_window/constrained_window_views.h" |
| 8 #include "components/constrained_window/native_web_contents_modal_dialog_manager
_views.h" | 8 #include "components/constrained_window/native_web_contents_modal_dialog_manager
_views.h" |
| 9 #include "components/web_modal/single_web_contents_dialog_manager.h" | 9 #include "components/web_modal/single_web_contents_dialog_manager.h" |
| 10 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 10 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "ui/base/accelerators/accelerator.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 13 | 14 |
| 14 namespace constrained_window { | 15 namespace constrained_window { |
| 15 | 16 |
| 16 void ShowModalDialog(gfx::NativeWindow dialog, | 17 void ShowModalDialog(gfx::NativeWindow dialog, |
| 17 content::WebContents* web_contents) { | 18 content::WebContents* web_contents) { |
| 18 web_modal::WebContentsModalDialogManager* manager = | 19 web_modal::WebContentsModalDialogManager* manager = |
| 19 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); | 20 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| 20 DCHECK(manager); | 21 DCHECK(manager); |
| 21 std::unique_ptr<web_modal::SingleWebContentsDialogManager> dialog_manager( | 22 std::unique_ptr<web_modal::SingleWebContentsDialogManager> dialog_manager( |
| 22 new constrained_window::NativeWebContentsModalDialogManagerViews( | 23 new constrained_window::NativeWebContentsModalDialogManagerViews( |
| 23 dialog, manager)); | 24 dialog, manager, false, NULL)); |
| 24 manager->ShowDialogWithManager(dialog, std::move(dialog_manager)); | 25 manager->ShowDialogWithManager(dialog, std::move(dialog_manager)); |
| 25 } | 26 } |
| 26 | 27 |
| 28 void ShowTopLevelModalDialog(gfx::NativeWindow dialog, |
| 29 content::WebContents* web_contents, |
| 30 ui::AcceleratorTarget* target) { |
| 31 web_modal::WebContentsModalDialogManager* manager = |
| 32 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents); |
| 33 DCHECK(manager); |
| 34 std::unique_ptr<web_modal::SingleWebContentsDialogManager> dialog_manager( |
| 35 new constrained_window::NativeWebContentsModalDialogManagerViews( |
| 36 dialog, manager, true, target)); |
| 37 manager->ShowDialogWithManager(dialog, std::move(dialog_manager)); |
| 38 } |
| 27 } // namespace constrained_window | 39 } // namespace constrained_window |
| OLD | NEW |