Chromium Code Reviews| 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 #ifndef COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ | 5 #ifndef COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ |
| 6 #define COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ | 6 #define COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ui/base/accelerators/accelerator.h" | |
| 10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 class WebContents; | 14 class WebContents; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 class DialogDelegate; | 18 class DialogDelegate; |
| 18 class Widget; | 19 class Widget; |
| 19 class WidgetDelegate; | 20 class WidgetDelegate; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 40 | 41 |
| 41 void UpdateWidgetModalDialogPosition( | 42 void UpdateWidgetModalDialogPosition( |
| 42 views::Widget* widget, | 43 views::Widget* widget, |
| 43 web_modal::ModalDialogHost* dialog_host); | 44 web_modal::ModalDialogHost* dialog_host); |
| 44 | 45 |
| 45 // Shows the dialog with a new SingleWebContentsDialogManager. The dialog will | 46 // Shows the dialog with a new SingleWebContentsDialogManager. The dialog will |
| 46 // notify via WillClose() when it is being destroyed. | 47 // notify via WillClose() when it is being destroyed. |
| 47 void ShowModalDialog(gfx::NativeWindow dialog, | 48 void ShowModalDialog(gfx::NativeWindow dialog, |
| 48 content::WebContents* web_contents); | 49 content::WebContents* web_contents); |
| 49 | 50 |
| 51 // Shows the dialog with a new SingleWebContentsDialogManager as a top level | |
| 52 // dialog (peer of the |web_contents| native window dialog host rather than a | |
|
sky
2016/09/16 16:40:24
It isn't a peer, is it? It's a top level, right?
| |
| 53 // child). The dialog is top level but will not block access to the dialog host | |
| 54 // window, which will be its transient parent. The dialog will notify via | |
| 55 // WillClose() when it is being destroyed. |target| will be attached to the host | |
| 56 // window as a handler for accelerators. | |
| 57 void ShowTopLevelModalDialog(gfx::NativeWindow dialog, | |
|
sky
2016/09/16 16:40:24
Can we move this logic into ShowWebModalDialogView
| |
| 58 content::WebContents* web_contents, | |
| 59 ui::AcceleratorTarget *target); | |
| 60 | |
| 50 // Calls CreateWebModalDialogViews, shows the dialog, and returns its widget. | 61 // Calls CreateWebModalDialogViews, shows the dialog, and returns its widget. |
| 51 views::Widget* ShowWebModalDialogViews( | 62 views::Widget* ShowWebModalDialogViews( |
| 52 views::WidgetDelegate* dialog, | 63 views::WidgetDelegate* dialog, |
| 53 content::WebContents* initiator_web_contents); | 64 content::WebContents* initiator_web_contents); |
| 54 | 65 |
| 55 #if defined(OS_MACOSX) | 66 #if defined(OS_MACOSX) |
| 56 // Like ShowWebModalDialogViews, but used to show a native dialog "sheet" on | 67 // Like ShowWebModalDialogViews, but used to show a native dialog "sheet" on |
| 57 // Mac. Sheets are always modal to their parent window. To make them tab-modal, | 68 // Mac. Sheets are always modal to their parent window. To make them tab-modal, |
| 58 // this provides an invisible tab-modal overlay window managed by | 69 // this provides an invisible tab-modal overlay window managed by |
| 59 // WebContentsModalDialogManager, which can host a dialog sheet. | 70 // WebContentsModalDialogManager, which can host a dialog sheet. |
| 60 views::Widget* ShowWebModalDialogWithOverlayViews( | 71 views::Widget* ShowWebModalDialogWithOverlayViews( |
| 61 views::WidgetDelegate* dialog, | 72 views::WidgetDelegate* dialog, |
| 62 content::WebContents* initiator_web_contents); | 73 content::WebContents* initiator_web_contents); |
| 63 #endif | 74 #endif |
| 64 | 75 |
| 76 // Creates a widget for |dialog| and shows the dialog as a top level dialog | |
| 77 // that does not block events to the top level dialog host window for | |
| 78 // |web_contents|. Returns the widget created. For Mac, which uses sheets, | |
| 79 // this has the same behavior as ShowWebModalDialogViews. | |
| 80 views::Widget* ShowTopLevelWebModalDialogViews( | |
|
sky
2016/09/16 16:40:24
I'm confused by the need for this and ShowTopLevel
| |
| 81 views::WidgetDelegate* dialog, | |
| 82 content::WebContents* initiator_web_contents, | |
| 83 ui::AcceleratorTarget* target); | |
| 84 | |
| 65 // Create a widget for |dialog| that is modal to |web_contents|. | 85 // Create a widget for |dialog| that is modal to |web_contents|. |
| 66 // The modal type of |dialog->GetModalType()| must be ui::MODAL_TYPE_CHILD. | 86 // The modal type of |dialog->GetModalType()| must be ui::MODAL_TYPE_CHILD. |
| 67 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, | 87 views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog, |
| 68 content::WebContents* web_contents); | 88 content::WebContents* web_contents); |
| 69 | 89 |
| 70 // Create a widget for |dialog| that has a modality given by | 90 // Create a widget for |dialog| that has a modality given by |
| 71 // |dialog->GetModalType()|. The modal type must be either | 91 // |dialog->GetModalType()|. The modal type must be either |
| 72 // ui::MODAL_TYPE_SYSTEM or ui::MODAL_TYPE_WINDOW. This places the | 92 // ui::MODAL_TYPE_SYSTEM or ui::MODAL_TYPE_WINDOW. This places the |
| 73 // dialog appropriately if |parent| is a valid browser window. | 93 // dialog appropriately if |parent| is a valid browser window. |
| 74 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, | 94 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog, |
| 75 gfx::NativeWindow parent); | 95 gfx::NativeWindow parent); |
| 76 | 96 |
| 77 } // namespace constrained_window | 97 } // namespace constrained_window |
| 78 | 98 |
| 79 #endif // COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ | 99 #endif // COMPONENTS_CONSTRAINED_WINDOW_CONSTRAINED_WINDOW_VIEWS_H_ |
| OLD | NEW |