Force close browsers and handle bigpicture exit

Call CloseBrowser(true) for chrome, popup and tab browsers to force shutdown. Immediately destroy the top-level window and call MaybeFinishShutdown() to avoid hangs when WM_CLOSE is not resent by Alloy child-window paths. Route "close" and new "exit-bigpicture" chrome commands through OnWindowCloseRequested so they trigger the same shutdown flow. Add IsBigPictureFrame and permit the "exit-bigpicture" process message from bigpicture internal frames.
This commit is contained in:
Andrew Zambazos
2026-05-18 18:35:18 +12:00
parent c514e4faec
commit b4d93f24cd
2 changed files with 28 additions and 9 deletions
+14 -1
View File
@@ -25,6 +25,16 @@ bool IsSettingsFrame(CefRefPtr<CefFrame> frame) {
return nebula::ui::ToInternalUrl(frame->GetURL().ToString()).starts_with("nebula://settings");
}
bool IsBigPictureFrame(CefRefPtr<CefFrame> frame) {
if (!frame) {
return false;
}
const std::string url = nebula::ui::ToInternalUrl(frame->GetURL().ToString());
return url.starts_with("nebula://bigpicture") ||
url.starts_with("nebula://big-picture");
}
std::vector<std::string> ToStringVector(const std::vector<CefString>& values) {
std::vector<std::string> result;
result.reserve(values.size());
@@ -67,7 +77,10 @@ bool NebulaBrowserClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser
command == "new-tab" ||
command == "clear-site-history" ||
command == "clear-search-history");
if (!allowed_insecure_command && !allowed_settings_command) {
const bool allowed_big_picture_command =
IsBigPictureFrame(frame) && command == "exit-bigpicture";
if (!allowed_insecure_command && !allowed_settings_command &&
!allowed_big_picture_command) {
return false;
}
}