Move kDarkLightMode feature from ash to chromeos.
It's needed in lacros-chrome. For the sake of reducing churn at ~50
callsites, ash::features::IsDarkLightModeEnabled() is left in place as
a thunk to chromeos::features::IsDarkLightModeEnabled().
This also brings the about:flags entry to Lacros.
Bug: 1278862
Change-Id: I8d8ee204888d5a9857dc7891c0092e8a99cffb51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3339778
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Min Chen <minch@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#952049}
diff --git a/ash/BUILD.gn b/ash/BUILD.gn
index 0812dd74..8b298f3 100644
--- a/ash/BUILD.gn
+++ b/ash/BUILD.gn
@@ -2748,6 +2748,7 @@
"//chromeos/components/sensors:sensors",
"//chromeos/components/sensors:test_support",
"//chromeos/components/sensors/mojom",
+ "//chromeos/constants",
"//chromeos/dbus:test_support",
"//chromeos/dbus/audio",
"//chromeos/dbus/hammerd",
diff --git a/ash/DEPS b/ash/DEPS
index 6e2b0963..f07d3bc 100644
--- a/ash/DEPS
+++ b/ash/DEPS
@@ -61,6 +61,7 @@
"+chromeos/components/multidevice",
"+chromeos/components/quick_answers",
"+chromeos/components/sensors",
+ "+chromeos/constants",
# crosapi is an API to support lacros.
"+chromeos/crosapi",
# //ash can access all D-Bus client libraries. The mustash project previously
diff --git a/ash/app_list/views/assistant/assistant_dialog_plate_unittest.cc b/ash/app_list/views/assistant/assistant_dialog_plate_unittest.cc
index 2f2cc15..12ced5ef 100644
--- a/ash/app_list/views/assistant/assistant_dialog_plate_unittest.cc
+++ b/ash/app_list/views/assistant/assistant_dialog_plate_unittest.cc
@@ -8,13 +8,13 @@
#include "ash/assistant/test/assistant_ash_test_base.h"
#include "ash/assistant/ui/assistant_ui_constants.h"
#include "ash/assistant/ui/assistant_view_ids.h"
-#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/style/color_provider.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/style/ash_color_provider.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/controls/textfield/textfield.h"
@@ -23,10 +23,11 @@
using AssistantDialogPlateTest = AssistantAshTestBase;
TEST_F(AssistantDialogPlateTest, DarkAndLightTheme) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
- ASSERT_TRUE(features::IsDarkLightModeEnabled());
+ ASSERT_TRUE(chromeos::features::IsDarkLightModeEnabled());
ASSERT_FALSE(ColorProvider::Get()->IsDarkModeEnabled());
ShowAssistantUi();
@@ -50,7 +51,7 @@
}
TEST_F(AssistantDialogPlateTest, DarkAndLightModeFlagOff) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
ShowAssistantUi();
diff --git a/ash/app_list/views/assistant/assistant_main_stage_unittest.cc b/ash/app_list/views/assistant/assistant_main_stage_unittest.cc
index b4b2baa..e02c537 100644
--- a/ash/app_list/views/assistant/assistant_main_stage_unittest.cc
+++ b/ash/app_list/views/assistant/assistant_main_stage_unittest.cc
@@ -13,6 +13,7 @@
#include "ash/shell.h"
#include "ash/style/ash_color_provider.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
@@ -44,7 +45,8 @@
};
TEST_F(AssistantMainStageTest, DarkAndLightTheme) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
ASSERT_TRUE(features::IsDarkLightModeEnabled());
diff --git a/ash/app_list/views/assistant/assistant_page_view_unittest.cc b/ash/app_list/views/assistant/assistant_page_view_unittest.cc
index 419e750..c410e9f 100644
--- a/ash/app_list/views/assistant/assistant_page_view_unittest.cc
+++ b/ash/app_list/views/assistant/assistant_page_view_unittest.cc
@@ -19,6 +19,7 @@
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/assistant/public/cpp/assistant_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -932,7 +933,7 @@
TEST_F(AssistantPageNonBubbleTest, ThemeDarkLightMode) {
base::test::ScopedFeatureList scoped_feature_list_enable_dark_light_mode(
- features::kDarkLightMode);
+ chromeos::features::kDarkLightMode);
base::test::ScopedFeatureList scoped_feature_list_disable_blur;
scoped_feature_list_disable_blur.InitAndDisableFeature(
features::kEnableBackgroundBlur);
@@ -974,7 +975,8 @@
}
TEST_F(AssistantPageNonBubbleTest, ThemeDarkLightModeWithBlur) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
ASSERT_TRUE(features::IsBackgroundBlurEnabled());
@@ -1036,7 +1038,8 @@
TEST_F(AssistantPageBubbleTest, BackgroundColorInDarkLightMode) {
ASSERT_TRUE(features::IsProductivityLauncherEnabled());
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
ASSERT_FALSE(ColorProvider::Get()->IsDarkModeEnabled());
diff --git a/ash/assistant/assistant_controller_impl_unittest.cc b/ash/assistant/assistant_controller_impl_unittest.cc
index 109bed5f..9fac96b 100644
--- a/ash/assistant/assistant_controller_impl_unittest.cc
+++ b/ash/assistant/assistant_controller_impl_unittest.cc
@@ -11,7 +11,6 @@
#include "ash/assistant/test/assistant_ash_test_base.h"
#include "ash/assistant/test/test_assistant_service.h"
#include "ash/assistant/util/deep_link_util.h"
-#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/assistant/controller/assistant_controller_observer.h"
#include "ash/public/cpp/test/test_new_window_delegate.h"
@@ -20,6 +19,7 @@
#include "ash/style/ash_color_provider.h"
#include "base/scoped_observation.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/assistant/public/cpp/assistant_service.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -245,7 +245,7 @@
// flag is off. SettingsController won't set options if dark mode bit is not
// set.
TEST_F(AssistantControllerImplTest, ColorModeIsSetWhenAssistantIsReadyFlagOff) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
controller()->SetAssistant(test_assistant_service());
@@ -255,9 +255,9 @@
TEST_F(AssistantControllerImplTest, ColorModeIsUpdated) {
base::test::ScopedFeatureList feature_list;
- feature_list.InitAndEnableFeature(features::kDarkLightMode);
+ feature_list.InitAndEnableFeature(chromeos::features::kDarkLightMode);
- ASSERT_TRUE(features::IsDarkLightModeEnabled());
+ ASSERT_TRUE(chromeos::features::IsDarkLightModeEnabled());
// AshColorProvider::IsDarkModeEnabled reports it's in dark mode if active
// pref service is not set.
diff --git a/ash/assistant/ui/DEPS b/ash/assistant/ui/DEPS
index 1bc71ee..17f1d5c 100644
--- a/ash/assistant/ui/DEPS
+++ b/ash/assistant/ui/DEPS
@@ -15,6 +15,7 @@
"+cc/base",
"+cc/paint",
"+chromeos/assistant",
+ "+chromeos/constants",
"+chromeos/services/assistant/public",
"+chromeos/services/libassistant/public/cpp",
"+mojo/public/cpp",
diff --git a/ash/assistant/ui/colors/assistant_colors_util_unittest.cc b/ash/assistant/ui/colors/assistant_colors_util_unittest.cc
index 7159e92..e7f4858 100644
--- a/ash/assistant/ui/colors/assistant_colors_util_unittest.cc
+++ b/ash/assistant/ui/colors/assistant_colors_util_unittest.cc
@@ -5,13 +5,13 @@
#include "ash/assistant/ui/colors/assistant_colors_util.h"
#include "ash/assistant/ui/colors/assistant_colors.h"
-#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/style/ash_color_provider.h"
#include "ash/test/ash_test_base.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -21,7 +21,8 @@
using AssistantColorsUtilUnittest = AshTestBase;
TEST_F(AssistantColorsUtilUnittest, AssistantColor) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
@@ -42,7 +43,7 @@
}
TEST_F(AssistantColorsUtilUnittest, AssistantColorFlagOff) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
EXPECT_EQ(
ResolveAssistantColor(assistant_colors::ColorName::kBgAssistantPlate),
@@ -55,7 +56,7 @@
// ResolveAssistantColor falls back to assistant_colors::ResolveColor with dark
// mode off if the color is not defined in the cc file map and the flag is off.
TEST_F(AssistantColorsUtilUnittest, AssistantColorFlagOffFallback) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
EXPECT_EQ(ResolveAssistantColor(assistant_colors::ColorName::kGoogleBlue100),
assistant_colors::ResolveColor(
diff --git a/ash/assistant/ui/main_stage/assistant_onboarding_suggestion_view_unittest.cc b/ash/assistant/ui/main_stage/assistant_onboarding_suggestion_view_unittest.cc
index 9d5fabc..a9b6579 100644
--- a/ash/assistant/ui/main_stage/assistant_onboarding_suggestion_view_unittest.cc
+++ b/ash/assistant/ui/main_stage/assistant_onboarding_suggestion_view_unittest.cc
@@ -12,6 +12,7 @@
#include "ash/style/ash_color_provider.h"
#include "ash/test/ash_test_base.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/libassistant/public/cpp/assistant_suggestion.h"
#include "components/prefs/pref_service.h"
#include "ui/gfx/color_palette.h"
@@ -42,7 +43,8 @@
using AssistantOnboardingSuggestionViewTest = AshTestBase;
TEST_F(AssistantOnboardingSuggestionViewTest, DarkAndLightTheme) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
ASSERT_TRUE(features::IsDarkLightModeEnabled());
diff --git a/ash/assistant/ui/main_stage/assistant_onboarding_view_unittest.cc b/ash/assistant/ui/main_stage/assistant_onboarding_view_unittest.cc
index f92c721..e6eee08 100644
--- a/ash/assistant/ui/main_stage/assistant_onboarding_view_unittest.cc
+++ b/ash/assistant/ui/main_stage/assistant_onboarding_view_unittest.cc
@@ -17,7 +17,6 @@
#include "ash/assistant/ui/main_stage/assistant_onboarding_suggestion_view.h"
#include "ash/assistant/ui/test_support/mock_assistant_view_delegate.h"
#include "ash/assistant/util/test_support/macros.h"
-#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/assistant/controller/assistant_suggestions_controller.h"
#include "ash/public/cpp/assistant/controller/assistant_ui_controller.h"
@@ -31,6 +30,7 @@
#include "base/test/icu_test_util.h"
#include "base/test/scoped_feature_list.h"
#include "base/unguessable_token.h"
+#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/assistant/public/cpp/assistant_service.h"
#include "chromeos/ui/vector_icons/vector_icons.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -468,10 +468,11 @@
}
TEST_F(AssistantOnboardingViewTest, DarkAndLightTheme) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
- ASSERT_TRUE(features::IsDarkLightModeEnabled());
+ ASSERT_TRUE(chromeos::features::IsDarkLightModeEnabled());
ASSERT_FALSE(ColorProvider::Get()->IsDarkModeEnabled());
ShowAssistantUi();
@@ -496,7 +497,7 @@
}
TEST_F(AssistantOnboardingViewTest, DarkAndLightModeFlagOff) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
ShowAssistantUi();
diff --git a/ash/assistant/ui/main_stage/assistant_query_view_unittest.cc b/ash/assistant/ui/main_stage/assistant_query_view_unittest.cc
index 58bb6dbf..446ba2ae 100644
--- a/ash/assistant/ui/main_stage/assistant_query_view_unittest.cc
+++ b/ash/assistant/ui/main_stage/assistant_query_view_unittest.cc
@@ -15,6 +15,7 @@
#include "ash/style/ash_color_provider.h"
#include "base/feature_list.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/chromeos/styles/cros_styles.h"
#include "ui/compositor/layer.h"
@@ -28,7 +29,8 @@
using AssistantQueryViewUnittest = AssistantAshTestBase;
TEST_F(AssistantQueryViewUnittest, ThemeDarkLightMode) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
@@ -69,7 +71,7 @@
}
TEST_F(AssistantQueryViewUnittest, Theme) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
ShowAssistantUi();
diff --git a/ash/assistant/ui/main_stage/assistant_text_element_view_unittest.cc b/ash/assistant/ui/main_stage/assistant_text_element_view_unittest.cc
index def24dab..5b9a61f 100644
--- a/ash/assistant/ui/main_stage/assistant_text_element_view_unittest.cc
+++ b/ash/assistant/ui/main_stage/assistant_text_element_view_unittest.cc
@@ -5,7 +5,6 @@
#include "ash/assistant/ui/main_stage/assistant_text_element_view.h"
#include "ash/assistant/ui/assistant_ui_constants.h"
-#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/style/color_provider.h"
#include "ash/session/session_controller_impl.h"
@@ -13,6 +12,7 @@
#include "ash/style/ash_color_provider.h"
#include "ash/test/ash_test_base.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "ui/views/controls/label.h"
#include "ui/views/widget/widget.h"
@@ -25,10 +25,11 @@
using AssistantTextElementViewTest = AshTestBase;
TEST_F(AssistantTextElementViewTest, DarkAndLightTheme) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
- ASSERT_TRUE(features::IsDarkLightModeEnabled());
+ ASSERT_TRUE(chromeos::features::IsDarkLightModeEnabled());
ASSERT_FALSE(ColorProvider::Get()->IsDarkModeEnabled());
std::unique_ptr<views::Widget> widget = CreateFramelessTestWidget();
@@ -52,7 +53,7 @@
}
TEST_F(AssistantTextElementViewTest, DarkAndLightModeFlagOff) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
std::unique_ptr<views::Widget> widget = CreateFramelessTestWidget();
AssistantTextElementView* text_element_view = widget->SetContentsView(
diff --git a/ash/assistant/ui/main_stage/assistant_zero_state_view_unittest.cc b/ash/assistant/ui/main_stage/assistant_zero_state_view_unittest.cc
index 24a7c31..077167d2 100644
--- a/ash/assistant/ui/main_stage/assistant_zero_state_view_unittest.cc
+++ b/ash/assistant/ui/main_stage/assistant_zero_state_view_unittest.cc
@@ -8,12 +8,12 @@
#include "ash/assistant/ui/assistant_ui_constants.h"
#include "ash/assistant/ui/assistant_view_ids.h"
#include "ash/assistant/ui/colors/assistant_colors.h"
-#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/style/ash_color_provider.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/chromeos/styles/cros_styles.h"
#include "ui/views/controls/label.h"
@@ -24,7 +24,7 @@
using AssistantZeroStateViewUnittest = AssistantAshTestBase;
TEST_F(AssistantZeroStateViewUnittest, Theme) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
ShowAssistantUi();
@@ -36,7 +36,8 @@
}
TEST_F(AssistantZeroStateViewUnittest, ThemeDarkLightMode) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
diff --git a/ash/assistant/ui/main_stage/suggestion_chip_view_unittest.cc b/ash/assistant/ui/main_stage/suggestion_chip_view_unittest.cc
index a9b5480..6b6ce70f 100644
--- a/ash/assistant/ui/main_stage/suggestion_chip_view_unittest.cc
+++ b/ash/assistant/ui/main_stage/suggestion_chip_view_unittest.cc
@@ -8,7 +8,6 @@
#include "ash/assistant/ui/assistant_view_ids.h"
#include "ash/assistant/ui/test_support/mock_assistant_view_delegate.h"
#include "ash/assistant/util/test_support/macros.h"
-#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/style/color_provider.h"
#include "ash/session/session_controller_impl.h"
@@ -18,6 +17,7 @@
#include "base/test/scoped_feature_list.h"
#include "cc/paint/paint_flags.h"
#include "cc/test/pixel_comparator.h"
+#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/assistant/public/cpp/assistant_service.h"
#include "chromeos/ui/vector_icons/vector_icons.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -124,10 +124,11 @@
}
TEST_F(SuggestionChipViewTest, DarkAndLightTheme) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
- ASSERT_TRUE(features::IsDarkLightModeEnabled());
+ ASSERT_TRUE(chromeos::features::IsDarkLightModeEnabled());
ASSERT_FALSE(ColorProvider::Get()->IsDarkModeEnabled());
auto widget = CreateFramelessTestWidget();
@@ -199,7 +200,7 @@
}
TEST_F(SuggestionChipViewTest, DarkAndLightModeFlagOff) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
auto widget = CreateFramelessTestWidget();
auto* suggestion_chip_view =
diff --git a/ash/assistant/ui/main_stage/ui_element_container_view_unittest.cc b/ash/assistant/ui/main_stage/ui_element_container_view_unittest.cc
index 55d7c4ab..ceb589b5 100644
--- a/ash/assistant/ui/main_stage/ui_element_container_view_unittest.cc
+++ b/ash/assistant/ui/main_stage/ui_element_container_view_unittest.cc
@@ -7,7 +7,6 @@
#include "ash/assistant/assistant_interaction_controller_impl.h"
#include "ash/assistant/test/assistant_ash_test_base.h"
#include "ash/assistant/ui/assistant_view_ids.h"
-#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/assistant/controller/assistant_interaction_controller.h"
#include "ash/session/session_controller_impl.h"
@@ -15,6 +14,7 @@
#include "ash/style/ash_color_provider.h"
#include "base/test/scoped_feature_list.h"
#include "cc/base/math_util.h"
+#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/libassistant/public/cpp/assistant_interaction_metadata.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/color_palette.h"
@@ -32,10 +32,11 @@
using UiElementContainerViewTest = AssistantAshTestBase;
TEST_F(UiElementContainerViewTest, DarkAndLightTheme) {
- base::test::ScopedFeatureList scoped_feature_list(features::kDarkLightMode);
+ base::test::ScopedFeatureList scoped_feature_list(
+ chromeos::features::kDarkLightMode);
AshColorProvider::Get()->OnActiveUserPrefServiceChanged(
Shell::Get()->session_controller()->GetActivePrefService());
- ASSERT_TRUE(features::IsDarkLightModeEnabled());
+ ASSERT_TRUE(chromeos::features::IsDarkLightModeEnabled());
ASSERT_FALSE(AshColorProvider::Get()->IsDarkModeEnabled());
ShowAssistantUi();
@@ -58,7 +59,7 @@
}
TEST_F(UiElementContainerViewTest, DarkAndLightModeFlagOff) {
- ASSERT_FALSE(features::IsDarkLightModeEnabled());
+ ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled());
ShowAssistantUi();
diff --git a/ash/constants/BUILD.gn b/ash/constants/BUILD.gn
index ebcd13a..bbf5dab 100644
--- a/ash/constants/BUILD.gn
+++ b/ash/constants/BUILD.gn
@@ -26,6 +26,7 @@
]
public_deps = [
"//base",
+ "//chromeos/constants",
"//skia",
"//third_party/abseil-cpp:absl",
]
diff --git a/ash/constants/DEPS b/ash/constants/DEPS
index 0eda6c8..6a39252 100644
--- a/ash/constants/DEPS
+++ b/ash/constants/DEPS
@@ -5,6 +5,7 @@
"+ash/constants",
"+base",
"+build",
+ "+chromeos/constants",
"+third_party/abseil-cpp/absl/types/optional.h",
]
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc
index 2cf5855..acf18902d 100644
--- a/ash/constants/ash_features.cc
+++ b/ash/constants/ash_features.cc
@@ -10,6 +10,7 @@
#include "base/metrics/field_trial_params.h"
#include "base/system/sys_info.h"
#include "build/build_config.h"
+#include "chromeos/constants/chromeos_features.h"
namespace ash {
namespace features {
@@ -369,10 +370,6 @@
const base::Feature kCryptohomeRecoveryFlow{"CryptohomeRecoveryFlow",
base::FEATURE_DISABLED_BY_DEFAULT};
-// Enables dark/light mode feature.
-const base::Feature kDarkLightMode{"DarkLightMode",
- base::FEATURE_DISABLED_BY_DEFAULT};
-
const base::Feature kDemoModeSWA{"DemoModeSWA",
base::FEATURE_DISABLED_BY_DEFAULT};
@@ -1446,7 +1443,7 @@
}
bool IsDarkLightModeEnabled() {
- return base::FeatureList::IsEnabled(kDarkLightMode);
+ return chromeos::features::IsDarkLightModeEnabled();
}
bool IsDemoModeSWAEnabled() {
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h
index b34e082..56d9c8b6 100644
--- a/ash/constants/ash_features.h
+++ b/ash/constants/ash_features.h
@@ -152,7 +152,6 @@
extern const base::Feature kCryptAuthV2Enrollment;
COMPONENT_EXPORT(ASH_CONSTANTS)
extern const base::Feature kCryptohomeRecoveryFlow;
-COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kDarkLightMode;
COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kDemoModeSWA;
COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kDeskTemplateSync;
COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kDeviceActiveClient;
diff --git a/ash/style/ash_color_provider_unittests.cc b/ash/style/ash_color_provider_unittests.cc
index df6e6d7..dd85bf3 100644
--- a/ash/style/ash_color_provider_unittests.cc
+++ b/ash/style/ash_color_provider_unittests.cc
@@ -4,10 +4,10 @@
#include "ash/style/ash_color_provider.h"
-#include "ash/constants/ash_features.h"
#include "ash/session/test_session_controller_client.h"
#include "ash/test/ash_test_base.h"
#include "base/test/scoped_feature_list.h"
+#include "chromeos/constants/chromeos_features.h"
namespace ash {
@@ -21,7 +21,7 @@
// When dark/light mode is enabled. Color mode in non-active user sessions
// (e.g, login page) should be DARK, but LIGHT while in OOBE.
base::test::ScopedFeatureList enable_dark_light;
- enable_dark_light.InitAndEnableFeature(features::kDarkLightMode);
+ enable_dark_light.InitAndEnableFeature(chromeos::features::kDarkLightMode);
client->SetSessionState(session_manager::SessionState::UNKNOWN);
EXPECT_TRUE(color_provider->IsDarkModeEnabled());
client->SetSessionState(session_manager::SessionState::OOBE);
@@ -30,7 +30,7 @@
// When dark/light mode is disabled. Color mode in non-active user sessions
// (e.g, login page) should still be DARK.
base::test::ScopedFeatureList disable_dark_light;
- disable_dark_light.InitAndDisableFeature(features::kDarkLightMode);
+ disable_dark_light.InitAndDisableFeature(chromeos::features::kDarkLightMode);
client->SetSessionState(session_manager::SessionState::UNKNOWN);
EXPECT_TRUE(color_provider->IsDarkModeEnabled());
client->SetSessionState(session_manager::SessionState::OOBE);
diff --git a/ash/wallpaper/wallpaper_controller_unittest.cc b/ash/wallpaper/wallpaper_controller_unittest.cc
index e8b6c17..5529a97 100644
--- a/ash/wallpaper/wallpaper_controller_unittest.cc
+++ b/ash/wallpaper/wallpaper_controller_unittest.cc
@@ -48,6 +48,7 @@
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time_override.h"
+#include "chromeos/constants/chromeos_features.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/user_manager/fake_user_manager.h"
#include "components/user_manager/scoped_user_manager.h"
@@ -3250,7 +3251,7 @@
void SetUp() override {
scoped_feature_list_.InitWithFeatures(
{features::kWallpaperWebUI, features::kWallpaperFullScreenPreview,
- features::kDarkLightMode},
+ chromeos::features::kDarkLightMode},
{});
WallpaperControllerTestBase::SetUp();
}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 4109bff..e2b5687 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -3005,9 +3005,6 @@
flag_descriptions::kUseHDRTransferFunctionName,
flag_descriptions::kUseHDRTransferFunctionDescription, kOsCrOS,
FEATURE_VALUE_TYPE(display::features::kUseHDRTransferFunction)},
- {"dark-light-mode", flag_descriptions::kDarkLightTestName,
- flag_descriptions::kDarkLightTestDescription, kOsCrOS,
- FEATURE_VALUE_TYPE(ash::features::kDarkLightMode)},
{"vertical-snap", flag_descriptions::kVerticalSnapName,
flag_descriptions::kVerticalSnapDescription, kOsCrOS,
FEATURE_VALUE_TYPE(chromeos::wm::features::kVerticalSnap)},
@@ -3229,6 +3226,9 @@
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if defined(OS_CHROMEOS)
+ {"dark-light-mode", flag_descriptions::kDarkLightTestName,
+ flag_descriptions::kDarkLightTestDescription, kOsCrOS,
+ FEATURE_VALUE_TYPE(chromeos::features::kDarkLightMode)},
// TODO(b/180051795): remove kOsLinux when lacros-chrome switches to
// kOsCrOS.
{"deprecate-low-usage-codecs",
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc
index f9ff708..8a9cc785f 100644
--- a/chromeos/constants/chromeos_features.cc
+++ b/chromeos/constants/chromeos_features.cc
@@ -23,6 +23,10 @@
const base::Feature kBluetoothPhoneFilter{"BluetoothPhoneFilter",
base::FEATURE_ENABLED_BY_DEFAULT};
+// Enables dark/light mode feature.
+const base::Feature kDarkLightMode{"DarkLightMode",
+ base::FEATURE_DISABLED_BY_DEFAULT};
+
// Disables translation services of the Quick Answers V2.
const base::Feature kDisableQuickAnswersV2Translation{
"DisableQuickAnswersV2Translation", base::FEATURE_DISABLED_BY_DEFAULT};
@@ -35,6 +39,10 @@
return base::FeatureList::IsEnabled(kBluetoothAdvertisementMonitoring);
}
+bool IsDarkLightModeEnabled() {
+ return base::FeatureList::IsEnabled(kDarkLightMode);
+}
+
bool IsQuickAnswersV2TranslationDisabled() {
return base::FeatureList::IsEnabled(kDisableQuickAnswersV2Translation);
}
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h
index 6bd8e89..9c939cd 100644
--- a/chromeos/constants/chromeos_features.h
+++ b/chromeos/constants/chromeos_features.h
@@ -26,6 +26,7 @@
extern const base::Feature kBluetoothAdvertisementMonitoring;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kBluetoothPhoneFilter;
+COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kDarkLightMode;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kDisableQuickAnswersV2Translation;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
@@ -35,6 +36,7 @@
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
bool IsBluetoothAdvertisementMonitoringEnabled();
+COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsDarkLightModeEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsQuickAnswersV2TranslationDisabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
bool IsQuickAnswersV2SettingsSubToggleEnabled();