chrome: Add callback for already running app relaunch (fixes #3609)

Adds a new CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch
callback for when an already running app is relaunched with the
same CefSettings.root_cache_path.

Client apps should check the CefInitialize() return value for early
exit of the relaunch source process.
This commit is contained in:
Marshall Greenblatt
2023-11-28 20:33:44 -05:00
parent d6af79e7a6
commit a25f89f9e4
45 changed files with 553 additions and 178 deletions

View File

@@ -137,13 +137,14 @@ CefRefPtr<ViewsWindow> ViewsWindow::Create(
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) {
CefRefPtr<CefRequestContext> request_context,
CefRefPtr<CefCommandLine> command_line) {
CEF_REQUIRE_UI_THREAD();
DCHECK(delegate);
// Create a new ViewsWindow.
CefRefPtr<ViewsWindow> views_window =
new ViewsWindow(type, delegate, nullptr);
new ViewsWindow(type, delegate, nullptr, command_line);
// Create a new BrowserView.
CefRefPtr<CefBrowserView> browser_view = CefBrowserView::CreateBrowserView(
@@ -473,7 +474,7 @@ CefRefPtr<CefBrowserViewDelegate> ViewsWindow::GetDelegateForPopupBrowserView(
// Create a new ViewsWindow for the popup BrowserView.
return new ViewsWindow(
is_devtools ? WindowType::DEVTOOLS : WindowType::NORMAL, popup_delegate,
nullptr);
nullptr, command_line_);
}
bool ViewsWindow::OnPopupBrowserViewCreated(
@@ -1037,19 +1038,19 @@ void ViewsWindow::MenuBarExecuteCommand(CefRefPtr<CefMenuModel> menu_model,
ViewsWindow::ViewsWindow(WindowType type,
Delegate* delegate,
CefRefPtr<CefBrowserView> browser_view)
CefRefPtr<CefBrowserView> browser_view,
CefRefPtr<CefCommandLine> command_line)
: type_(type),
delegate_(delegate),
command_line_(command_line),
menu_has_focus_(false),
last_focused_view_(false) {
DCHECK(delegate_);
if (browser_view) {
SetBrowserView(browser_view);
}
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
const bool is_normal_type = type_ == WindowType::NORMAL;
with_controls_ = is_normal_type && delegate_->WithControls();