feat: default browseros theme

This commit is contained in:
Nikhil Sonti
2026-03-03 17:30:43 -08:00
parent 02bccccf99
commit a63ce24d70
4 changed files with 57 additions and 4 deletions

View File

@@ -1,9 +1,9 @@
diff --git a/chrome/browser/browseros/core/browseros_prefs.cc b/chrome/browser/browseros/core/browseros_prefs.cc
new file mode 100644
index 0000000000000..f37f67aa3aca1
index 0000000000000..f3a2e43cd7af2
--- /dev/null
+++ b/chrome/browser/browseros/core/browseros_prefs.cc
@@ -0,0 +1,73 @@
@@ -0,0 +1,90 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
@@ -13,6 +13,8 @@ index 0000000000000..f37f67aa3aca1
+#include "chrome/browser/ui/actions/chrome_action_id.h"
+#include "chrome/common/pref_names.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/mojom/themes.mojom.h"
+
+namespace browseros {
+
@@ -57,6 +59,21 @@ index 0000000000000..f37f67aa3aca1
+ }
+}
+
+void SyncDefaultTheme(PrefService* pref_service) {
+ const PrefService::Preference* user_color_pref =
+ pref_service->FindPreference(::prefs::kUserColor);
+ if (user_color_pref && user_color_pref->IsDefaultValue()) {
+ // Blue tonal spot: SkColorSetRGB(140, 171, 228)
+ pref_service->SetInteger(::prefs::kUserColor,
+ static_cast<int>(SkColorSetRGB(140, 171, 228)));
+ pref_service->SetString(::prefs::kCurrentThemeID,
+ "user_color_theme_id");
+ pref_service->SetInteger(
+ ::prefs::kBrowserColorVariant,
+ static_cast<int>(ui::mojom::BrowserColorVariant::kTonalSpot));
+ }
+}
+
+const char* GetVisibilityPrefForAction(actions::ActionId id) {
+ switch (id) {
+ case kActionSidePanelShowThirdPartyLlm:

View File

@@ -1,9 +1,9 @@
diff --git a/chrome/browser/browseros/core/browseros_prefs.h b/chrome/browser/browseros/core/browseros_prefs.h
new file mode 100644
index 0000000000000..88cdbb73caf77
index 0000000000000..2719852d7d8c6
--- /dev/null
+++ b/chrome/browser/browseros/core/browseros_prefs.h
@@ -0,0 +1,76 @@
@@ -0,0 +1,80 @@
+// Copyright 2025 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
@@ -67,6 +67,10 @@ index 0000000000000..88cdbb73caf77
+// reflects BrowserOS's default.
+void SyncVerticalTabsPref(PrefService* pref_service);
+
+// Sets the default BrowserOS theme (blue tonal spot) on first run
+// when the user hasn't customized the theme yet.
+void SyncDefaultTheme(PrefService* pref_service);
+
+// Check if a toolbar action should be shown based on its visibility pref.
+// Returns true if:
+// - Action has no visibility pref (e.g., Assistant - always visible)

View File

@@ -0,0 +1,12 @@
diff --git a/chrome/browser/themes/BUILD.gn b/chrome/browser/themes/BUILD.gn
index 4924b822aa42e..1fcba3a9c4a6c 100644
--- a/chrome/browser/themes/BUILD.gn
+++ b/chrome/browser/themes/BUILD.gn
@@ -33,6 +33,7 @@ source_set("themes") {
]
deps = [
"//chrome/app/theme:theme_resources",
+ "//chrome/browser/browseros/core:prefs",
"//chrome/browser/new_tab_page/chrome_colors",
"//chrome/browser/search/background",
"//chrome/browser/search/background:constants",

View File

@@ -0,0 +1,20 @@
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 0589bacba844a..14bc76e5475f0 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -30,6 +30,7 @@
#include "base/task/thread_pool.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
+#include "chrome/browser/browseros/core/browseros_prefs.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
#include "chrome/browser/new_tab_page/chrome_colors/chrome_colors_util.h"
@@ -265,6 +266,7 @@ ThemeService::~ThemeService() = default;
void ThemeService::Init() {
theme_helper_->DCheckCalledOnValidSequence();
+ browseros::SyncDefaultTheme(profile_->GetPrefs());
InitFromPrefs();
// ThemeObserver should be constructed before calling