cefclient: Add option to create default popups (see issue #3165, see issue #3294)

This change adds a `--use-default-popup` command-line option to cefclient. When
specified, popup windows will be created with default styling (e.g. without an
application-provided native parent window).

This change also adds some reasonable default window bounds in cases where they
are not specified by the client.
This commit is contained in:
Marshall Greenblatt
2022-04-11 16:54:33 -04:00
parent 3000bc8748
commit 75ca552a4e
10 changed files with 46 additions and 6 deletions

View File

@@ -9,6 +9,7 @@
#include "include/base/cef_callback.h"
#include "include/base/cef_logging.h"
#include "include/wrapper/cef_helpers.h"
#include "tests/cefclient/browser/client_handler_std.h"
#include "tests/cefclient/browser/main_context.h"
#include "tests/cefclient/browser/test_runner.h"
#include "tests/shared/browser/extension_util.h"
@@ -130,13 +131,21 @@ scoped_refptr<RootWindow> RootWindowManager::CreateRootWindowAsPopup(
CefBrowserSettings& settings) {
CEF_REQUIRE_UI_THREAD();
MainContext::Get()->PopulateBrowserSettings(&settings);
if (MainContext::Get()->UseDefaultPopup()) {
// Use default window creation for the popup. A new |client| instance is
// still required by cefclient architecture.
client = new ClientHandlerStd(/*delegate=*/nullptr, with_controls,
/*startup_url=*/CefString());
return nullptr;
}
if (!temp_window_) {
// TempWindow must be created on the UI thread.
temp_window_.reset(new TempWindow());
}
MainContext::Get()->PopulateBrowserSettings(&settings);
scoped_refptr<RootWindow> root_window =
RootWindow::Create(MainContext::Get()->UseViews());
root_window->InitAsPopup(this, with_controls, with_osr, popupFeatures,