Add first-run setup and theme synchronization

Introduce first-run setup flow and live chrome theme syncing.

- Add first_run_state.cpp/.h to read/write a first_run_state.json under user data and decide whether to show the setup UI.
- Wire first-run logic into NebulaController: track first_run_setup_active_, create initial setup tab, defer/bring up chrome browser accordingly, and add CompleteFirstRunSetup() to persist state and finish setup.
- Add SendThemeToChromeSurfaces() and handle "theme-update" and "complete-first-run" chrome commands; restrict setup completion to setup frame.
- Expose GetFirstRunStatePath() and GetSetupUrl() in UI path helpers and include the state file in the build list (CMakeLists.txt).
- Update chrome UI: new CSS variables and styles for tabs/url-bar; chrome.js can apply themes (applyTheme), persist/load theme, and listen for storage updates to apply theme changes live.
- Update customization.js, settings.js, and setup.js to normalize/persist themes, send theme updates to the native host (or fallback), and communicate completion via the native bridge when available; include customization.js in setup.html.

These changes allow the app to run an interactive first-run setup and keep the separate chrome UI in sync with user-selected themes.
This commit is contained in:
Andrew Zambazos
2026-05-20 20:14:43 +12:00
parent bbba5b2927
commit 302753cd3d
14 changed files with 416 additions and 59 deletions
+11 -1
View File
@@ -26,6 +26,14 @@ bool IsSettingsFrame(CefRefPtr<CefFrame> frame) {
return nebula::ui::ToInternalUrl(frame->GetURL().ToString()).starts_with("nebula://settings");
}
bool IsSetupFrame(CefRefPtr<CefFrame> frame) {
if (!frame) {
return false;
}
return nebula::ui::ToInternalUrl(frame->GetURL().ToString()).starts_with("nebula://setup");
}
bool IsBigPictureFrame(CefRefPtr<CefFrame> frame) {
if (!frame) {
return false;
@@ -105,10 +113,12 @@ bool NebulaBrowserClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser
command == "new-tab" ||
command == "clear-site-history" ||
command == "clear-search-history");
const bool allowed_setup_command =
command == "complete-first-run" && IsSetupFrame(frame);
const bool allowed_big_picture_command =
IsBigPictureFrame(frame) && command == "exit-bigpicture";
if (!allowed_insecure_command && !allowed_settings_command &&
!allowed_big_picture_command) {
!allowed_setup_command && !allowed_big_picture_command) {
return false;
}
} else if (role_ == BrowserRole::BigPicture) {