cef/tests/cefclient/browser
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
..
binding_test.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
binding_test.h
browser_window_osr_gtk.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
browser_window_osr_gtk.h chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
browser_window_osr_mac.h chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
browser_window_osr_mac.mm Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
browser_window_osr_win.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
browser_window_osr_win.h chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
browser_window_std_gtk.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
browser_window_std_gtk.h chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
browser_window_std_mac.h chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
browser_window_std_mac.mm Update source files for bracket style 2023-01-04 17:47:17 -05:00
browser_window_std_win.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
browser_window_std_win.h chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
browser_window.cc Various fixes related to the C++11/14 update (see issue #3140) 2021-06-18 13:42:31 -04:00
browser_window.h Various fixes related to the C++11/14 update (see issue #3140) 2021-06-18 13:42:31 -04:00
bytes_write_handler.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
bytes_write_handler.h Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
client_app_delegates_browser.cc Move cookieable scheme configuration to settings (see issue #2969) 2021-04-09 15:04:24 -04:00
client_browser.cc chrome: cefclient: Add default handler for request tests (see issue #3444) 2023-02-17 16:01:22 -05:00
client_browser.h
client_handler_osr.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
client_handler_osr.h chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
client_handler_std.cc chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
client_handler_std.h chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280) 2022-03-22 15:11:47 -04:00
client_handler.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
client_handler.h Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
client_prefs.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
client_prefs.h cefclient: views: Support window state restore (see issue #3359) 2022-10-28 14:28:53 -04:00
client_types.h
default_client_handler.cc chrome: cefclient: Add default handler for request tests (see issue #3444) 2023-02-17 16:01:22 -05:00
default_client_handler.h chrome: cefclient: Add default handler for request tests (see issue #3444) 2023-02-17 16:01:22 -05:00
dialog_handler_gtk.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
dialog_handler_gtk.h Use Chrome file dialogs on all platforms and runtimes (fixes issue #3314) 2022-04-19 18:52:26 -04:00
dialog_test.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
dialog_test.h
image_cache.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
image_cache.h tests: Convert usage of base::Bind to Once or Repeating (see issue #3140) 2021-06-19 17:19:32 -04:00
main_context_impl_posix.cc
main_context_impl_win.cc Various fixes related to the C++11/14 update (see issue #3140) 2021-06-18 13:42:31 -04:00
main_context_impl.cc cefclient: Remove console message alert and update google URLs 2023-01-04 17:58:42 -05:00
main_context_impl.h cefclient: Add option to create default popups (see issue #3165, see issue #3294) 2022-04-12 11:49:27 -04:00
main_context.cc
main_context.h cefclient: Add option to create default popups (see issue #3165, see issue #3294) 2022-04-12 11:49:27 -04:00
main_message_loop_multithreaded_gtk.cc tests: Convert usage of base::Bind to Once or Repeating (see issue #3140) 2021-06-19 17:19:32 -04:00
main_message_loop_multithreaded_gtk.h Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
main_message_loop_multithreaded_win.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
main_message_loop_multithreaded_win.h Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
media_router_test.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
media_router_test.h
osr_accessibility_helper.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
osr_accessibility_helper.h
osr_accessibility_node_mac.mm Update source files for bracket style 2023-01-04 17:47:17 -05:00
osr_accessibility_node_win.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
osr_accessibility_node.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
osr_accessibility_node.h
osr_d3d11_win.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
osr_d3d11_win.h
osr_dragdrop_events.h
osr_dragdrop_win.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
osr_dragdrop_win.h Update source files for bracket style 2023-01-04 17:47:17 -05:00
osr_ime_handler_win.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
osr_ime_handler_win.h Update CefRange type to match gfx::Range (fixes #3422) 2023-05-16 14:44:19 +03:00
osr_render_handler_win_d3d11.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
osr_render_handler_win_d3d11.h Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
osr_render_handler_win_gl.cc Replace macros with C++17 features (see issue #3362) 2022-07-27 12:52:45 -04:00
osr_render_handler_win_gl.h Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
osr_render_handler_win.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
osr_render_handler_win.h
osr_renderer_settings.h
osr_renderer.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
osr_renderer.h
osr_window_win.cc Update CefRange type to match gfx::Range (fixes #3422) 2023-05-16 14:44:19 +03:00
osr_window_win.h Various fixes related to the C++11/14 update (see issue #3140) 2021-06-18 13:42:31 -04:00
preferences_test.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
preferences_test.h
print_handler_gtk.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
print_handler_gtk.h Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
resource_util_linux.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
resource_util_win_idmap.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
resource.h views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
response_filter_test.cc cefclient: Fix incorrect logic in PassThruResponseFilter 2023-03-06 16:48:03 +00:00
response_filter_test.h
root_window_create.cc Update to Chromium version 95.0.4638.0 (#920003) 2021-09-22 12:08:24 +03:00
root_window_gtk.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
root_window_gtk.h tests: Convert usage of base::Bind to Once or Repeating (see issue #3140) 2021-06-19 17:19:32 -04:00
root_window_mac.h tests: Convert usage of base::Bind to Once or Repeating (see issue #3140) 2021-06-19 17:19:32 -04:00
root_window_mac.mm views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
root_window_manager.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
root_window_manager.h tests: Convert usage of base::Bind to Once or Repeating (see issue #3140) 2021-06-19 17:19:32 -04:00
root_window_views.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
root_window_views.h views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
root_window_win.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
root_window_win.h cefclient: win: Support window state restore (see issue #3359) 2022-11-07 15:21:46 -05:00
root_window.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
root_window.h views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
scheme_test.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
scheme_test.h
server_test.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
server_test.h
temp_window_mac.h Various fixes related to the C++11/14 update (see issue #3140) 2021-06-18 13:42:31 -04:00
temp_window_mac.mm Update to Chromium version 104.0.5112.0 (#1012729) 2022-06-22 10:56:35 +03:00
temp_window_win.cc Various fixes related to the C++11/14 update (see issue #3140) 2021-06-18 13:42:31 -04:00
temp_window_win.h Various fixes related to the C++11/14 update (see issue #3140) 2021-06-18 13:42:31 -04:00
temp_window_x11.cc
temp_window_x11.h Various fixes related to the C++11/14 update (see issue #3140) 2021-06-18 13:42:31 -04:00
temp_window.h
test_runner.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
test_runner.h
text_input_client_osr_mac.h Update source files for bracket style 2023-01-04 17:47:17 -05:00
text_input_client_osr_mac.mm mac: cefclient: Fix compile error with Xcode 14.3.1 2023-06-02 17:28:41 +03:00
urlrequest_test.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
urlrequest_test.h
util_gtk.cc
util_gtk.h
views_menu_bar.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
views_menu_bar.h Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
views_overlay_controls.cc views: mac: Fix frameless window behavior (fixes issue #3189) 2023-02-28 18:34:12 +00:00
views_overlay_controls.h views: mac: Fix frameless window behavior (fixes issue #3189) 2023-02-28 18:34:12 +00:00
views_style.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
views_style.h views: Add support for absolute positioned overlay views. 2021-09-16 18:25:43 +03:00
views_window_mac.mm views: mac: Support dynamic resize of title bar height (see #3189) 2023-03-16 17:19:50 +00:00
views_window.cc views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
views_window.h views: Add support for modal browser dialogs 2023-06-21 11:18:24 +03:00
window_test_runner_gtk.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
window_test_runner_gtk.h Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
window_test_runner_mac.h Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
window_test_runner_mac.mm Update source files for bracket style 2023-01-04 17:47:17 -05:00
window_test_runner_views.cc views: mac: Support dynamic resize of title bar height (see #3189) 2023-03-16 17:19:50 +00:00
window_test_runner_views.h views: mac: Support dynamic resize of title bar height (see #3189) 2023-03-16 17:19:50 +00:00
window_test_runner_win.cc Update source files for bracket style 2023-01-04 17:47:17 -05:00
window_test_runner_win.h Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
window_test_runner.cc views: mac: Support dynamic resize of title bar height (see #3189) 2023-03-16 17:19:50 +00:00
window_test_runner.h views: mac: Support dynamic resize of title bar height (see #3189) 2023-03-16 17:19:50 +00:00
window_test.cc Remove CEF-specific integer and char16 typedef's (see #3507) 2023-06-01 19:32:36 +03:00
window_test.h