cef/libcef/browser/views
Marshall Greenblatt 0b99f92e97 views: Add support for modal browser dialogs
A modal dialog is a child CefWindow that implements some special behaviors
relative to a parent CefWindow. Like any CefWindow it can be framed with
titlebar or frameless, and optionally contain draggable regions (subject to
platform limitations described below). Modal dialogs are shown centered on
the parent window (inside a single display) and always stay on top of the
parent window in z-order. Sizing behavior and available window buttons are
controlled via the usual CefWindowDelegate callbacks. For example, the dialog
can have a preferred size with resize, minimize and maximize disabled (via
GetPreferredSize, CanResize, CanMinimize and CanMaximize respectively).

This change adds support for two modality modes. With window modality all
controls in the parent window are disabled. With browser modality only the
browser view in the parent window is disabled.

Both modality modes require that a valid parent window be returned via
GetParentWindow. For window modality return true from IsWindowModalDialog
and call CefWindow::Show. For browser modality return false from
IsWindowModalDialog (the default value) and call
CefWindow::ShowAsBrowserModalDialog with a reference to the parent window's
browser view.

Window modal dialog behavior depends on the platform. On Windows and
Linux these dialogs have a titlebar and can be moved independent of the
parent window. On macOS these dialogs do not have a titlebar, move with
the parent window, and do not support draggable regions (because they are
implemented using sheets). On Linux disabling the parent window controls
requires a window manager the supports _NET_WM_STATE_MODAL.

Browser modal dialog behavior is similar on all platforms. The dialog will
be automatically sized and positioned relative to the parent window's
browser view. Closing the parent window or navigating the parent browser
view will dismiss the dialog. The dialog can also be moved independent of
the parent window though it will be recentered when the parent window
itself is resized or redisplayed. On MacOS the dialog will move along with
the parent window while on Windows and Linux the parent window can be moved
independently.

To test: Use the Tests > Dialog Window menu option in cefclient with Views
enabled (`--use-views` or `--enable-chrome-runtime` command-line flag).
Browser modal dialog is the default behavior. For window modal dialog add
the `--use-window-modal-dialog` command-line flag.
2023-06-21 11:18:24 +03:00
..
basic_label_button_impl.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
basic_label_button_impl.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
basic_label_button_view.cc Apply clang-format to all C, C++ and ObjC files (issue #2171) 2017-05-18 12:30:05 +02:00
basic_label_button_view.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
basic_panel_impl.cc Apply clang-format to all C, C++ and ObjC files (issue #2171) 2017-05-18 12:30:05 +02:00
basic_panel_impl.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
basic_panel_view.cc Apply clang-format to all C, C++ and ObjC files (issue #2171) 2017-05-18 12:30:05 +02:00
basic_panel_view.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
box_layout_impl.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
box_layout_impl.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
browser_platform_delegate_views.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
browser_platform_delegate_views.h alloy: Use Chrome JS dialogs on Windows/Linux (fixes issue #3316) 2022-06-03 22:45:23 +03:00
browser_view_impl.cc alloy: views: mac: Add three-finger-swipe navigation gesture support 2023-05-26 09:05:33 +00:00
browser_view_impl.h alloy: views: mac: Add three-finger-swipe navigation gesture support 2023-05-26 09:05:33 +00:00
browser_view_view.cc alloy: views: mac: Add three-finger-swipe navigation gesture support 2023-05-26 09:05:33 +00:00
browser_view_view.h alloy: views: mac: Add three-finger-swipe navigation gesture support 2023-05-26 09:05:33 +00:00
button_impl.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
button_view.h Update source files for bracket style 2023-01-04 17:47:17 -05:00
display_impl.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
display_impl.h Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
fill_layout_impl.cc Apply clang-format to all C, C++ and ObjC files (issue #2171) 2017-05-18 12:30:05 +02:00
fill_layout_impl.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
label_button_impl.h Remove deprecated base::[Dictionary|List]Value API usage 2023-01-30 21:32:19 -05:00
label_button_view.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
layout_adapter.cc Implement Views framework on Windows and Linux (issue #1749). 2016-04-26 11:58:13 -04:00
layout_adapter.h Update to Chromium version 74.0.3729.0 (#638880) 2019-03-13 21:27:37 +00:00
layout_impl.h Update to Chromium revision bc084a8b (#530369) 2018-02-19 17:38:04 -05:00
layout_util.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
layout_util.h Update to Chromium revision 6e53600d (#386251) 2016-04-28 12:57:08 -04:00
menu_button_impl.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
menu_button_impl.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
menu_button_view.cc Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
menu_button_view.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
menu_runner_views.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
menu_runner_views.h Update to Chromium version 91.0.4472.0 (#870763) 2021-04-23 11:38:51 -04:00
native_widget_mac.h chrome: mac: Support dispatch of window commands (see #3462) 2023-04-20 12:26:07 -04:00
native_widget_mac.mm mac: Enable ARC in libcef (fixes #3496) 2023-05-09 18:26:47 +03:00
ns_window.h views: mac: Fix frameless window behavior (fixes issue #3189) 2023-02-28 18:34:12 +00:00
ns_window.mm views: mac: Fix frameless window behavior (fixes issue #3189) 2023-02-28 18:34:12 +00:00
overlay_view_host.cc views: mac: Fix overlay association with host CefWindow (fixes #3456) 2023-04-20 12:23:57 -04:00
overlay_view_host.h views: mac: Fix overlay association with host CefWindow (fixes #3456) 2023-04-20 12:23:57 -04:00
panel_impl.h Remove deprecated base::[Dictionary|List]Value API usage 2023-01-30 21:32:19 -05:00
panel_view.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
scroll_view_impl.cc Remove deprecated base::[Dictionary|List]Value API usage 2023-01-30 21:32:19 -05:00
scroll_view_impl.h Remove deprecated base::[Dictionary|List]Value API usage 2023-01-30 21:32:19 -05:00
scroll_view_view.cc Apply clang-format to all C, C++ and ObjC files (issue #2171) 2017-05-18 12:30:05 +02:00
scroll_view_view.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
textfield_impl.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
textfield_impl.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
textfield_view.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
textfield_view.h Remove DISALLOW_ macro from libcef/ (see issue #3234) 2021-12-07 15:02:28 -05:00
view_adapter.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
view_adapter.h Remove deprecated base::[Dictionary|List]Value API usage 2023-01-30 21:32:19 -05:00
view_impl.h Remove deprecated base::[Dictionary|List]Value API usage 2023-01-30 21:32:19 -05:00
view_util.cc views: mac: Fix overlay association with host CefWindow (fixes #3456) 2023-04-20 12:23:57 -04:00
view_util.h chrome: Improve positioning of the "Find" widget (fixes #3461) 2023-04-20 12:26:07 -04:00
view_util_aura.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
view_util_mac.mm chrome: Improve positioning of the "Find" widget (fixes #3461) 2023-04-20 12:26:07 -04:00
view_view.h Update source files for bracket style 2023-01-04 17:47:17 -05:00
widget_destruction_observer.h views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
window_impl.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
window_impl.h views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
window_view.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
window_view.h views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00