diff --git a/DEPS b/DEPS index a971e152428814..4d247a76004ff7 100644 --- a/DEPS +++ b/DEPS @@ -239,7 +239,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'e17fd4fea551ea554b67af7c044b5fbc1e90ce00', + 'skia_revision': 'dc60ca197e0280fb2fe82e42321498a0443b408f', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -247,7 +247,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '8419f4fcd1ec05ffac0ac51a1ac73f343dab00f4', + 'angle_revision': 'feb599ad894ba42e14c89a0c61f34bad8d575eeb', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -270,7 +270,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling googletest # and whatever else without interference from each other. - 'googletest_revision': '054a986a8513149e8374fc669a5fe40117ca6b41', + 'googletest_revision': '97a467571a0f615a4d96e79e4399c43221ca1232', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling lighttpd # and whatever else without interference from each other. @@ -306,7 +306,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'b759738dea9abafcbd0dc69553fd049a86e7b56b', + 'catapult_revision': '58f3a92099a02ccc517ce7bce93b75da0766b451', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -354,7 +354,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': '5397f9f9d0fa2d4adb03553f60d3fc4d4db5936c', + 'dawn_revision': '736dd07303323021e92fddc5be02a63af66c20ce', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -727,7 +727,7 @@ deps = { 'packages': [ { 'package': 'chromium/rts/model/mac-amd64', - 'version': 'ST_XL0WVEj5Xxvj-kAcMuyZsvgGw_VNlvbupF6-aFXUC', + 'version': 'LeoA0Wv35bgH_p5lOkwPxa1y0XTsB5tlcoYRFw8ioY4C', }, ], 'dep_type': 'cipd', @@ -1038,7 +1038,7 @@ deps = { }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '48b35e123dff26b1ede11104316cbb7f462db4e8', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'e88997a2613aaaabd83718ef25ff9a47bb70090c', 'src/third_party/devtools-frontend/src': Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), @@ -1700,7 +1700,7 @@ deps = { Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@b52ee54b2a18637068d39e2aa0f4d94588076891', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@cc4f8ef12d745384de360d967ac3f324fdeb8b67', 'condition': 'checkout_src_internal', }, diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 0812dd74f0e1b9..8b298f3d573bcf 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn @@ -2748,6 +2748,7 @@ test("ash_unittests") { "//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 6e2b0963744ffe..f07d3bcc919a0d 100644 --- a/ash/DEPS +++ b/ash/DEPS @@ -61,6 +61,7 @@ include_rules = [ "+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/accessibility/accessibility_controller_impl.cc b/ash/accessibility/accessibility_controller_impl.cc index 1958716b2486f8..d73d3b435b2cc5 100644 --- a/ash/accessibility/accessibility_controller_impl.cc +++ b/ash/accessibility/accessibility_controller_impl.cc @@ -430,27 +430,267 @@ std::string UmaNameForSwitchAccessCommand(SwitchAccessCommand command) { // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. -enum class SwitchAccessCommandKeyCode { +enum class SwitchAccessKeyCode { kUnknown = 0, - kNone = 1, - kSpace = 2, - kEnter = 3, - kMaxValue = kEnter, + kKeycode1 = 1, + kKeycode2 = 2, + kKeycode3 = 3, + kKeycode4 = 4, + kKeycode5 = 5, + kKeycode6 = 6, + kKeycode7 = 7, + kBackspace = 8, + kTab = 9, + kKeycode10 = 10, + kKeycode11 = 11, + kClear = 12, + kReturn = 13, + kKeycode14 = 14, + kKeycode15 = 15, + kShift = 16, + kControl = 17, + kAlt = 18, + kPause = 19, + kCapital = 20, + kKana = 21, + kKeycode22 = 22, + kJunja = 23, + kFinal = 24, + kHanja = 25, + kKeycode26 = 26, + kEscape = 27, + kConvert = 28, + kNonconvert = 29, + kAccept = 30, + kModechange = 31, + kSpace = 32, + kPrior = 33, + kNext = 34, + kEnd = 35, + kHome = 36, + kLeft = 37, + kUp = 38, + kRight = 39, + kDown = 40, + kSelect = 41, + kPrint = 42, + kExecute = 43, + kSnapshot = 44, + kInsert = 45, + kKeyDelete = 46, + kHelp = 47, + kNum0 = 48, + kNum1 = 49, + kNum2 = 50, + kNum3 = 51, + kNum4 = 52, + kNum5 = 53, + kNum6 = 54, + kNum7 = 55, + kNum8 = 56, + kNum9 = 57, + kKeycode58 = 58, + kKeycode59 = 59, + kKeycode60 = 60, + kKeycode61 = 61, + kKeycode62 = 62, + kKeycode63 = 63, + kKeycode64 = 64, + kA = 65, + kB = 66, + kC = 67, + kD = 68, + kE = 69, + kF = 70, + kG = 71, + kH = 72, + kI = 73, + kJ = 74, + kK = 75, + kL = 76, + kM = 77, + kN = 78, + kO = 79, + kP = 80, + kQ = 81, + kR = 82, + kS = 83, + kT = 84, + kU = 85, + kV = 86, + kW = 87, + kX = 88, + kY = 89, + kZ = 90, + kLwin = 91, + kRwin = 92, + kApps = 93, + kKeycode94 = 94, + kSleep = 95, + kNumpad0 = 96, + kNumpad1 = 97, + kNumpad2 = 98, + kNumpad3 = 99, + kNumpad4 = 100, + kNumpad5 = 101, + kNumpad6 = 102, + kNumpad7 = 103, + kNumpad8 = 104, + kNumpad9 = 105, + kMultiply = 106, + kAdd = 107, + kSeparator = 108, + kSubtract = 109, + kDecimal = 110, + kDivide = 111, + kF1 = 112, + kF2 = 113, + kF3 = 114, + kF4 = 115, + kF5 = 116, + kF6 = 117, + kF7 = 118, + kF8 = 119, + kF9 = 120, + kF10 = 121, + kF11 = 122, + kF12 = 123, + kF13 = 124, + kF14 = 125, + kF15 = 126, + kF16 = 127, + kF17 = 128, + kF18 = 129, + kF19 = 130, + kF20 = 131, + kF21 = 132, + kF22 = 133, + kF23 = 134, + kF24 = 135, + kKeycode136 = 136, + kKeycode137 = 137, + kKeycode138 = 138, + kKeycode139 = 139, + kKeycode140 = 140, + kKeycode141 = 141, + kKeycode142 = 142, + kKeycode143 = 143, + kNumlock = 144, + kScroll = 145, + kKeycode146 = 146, + kKeycode147 = 147, + kKeycode148 = 148, + kKeycode149 = 149, + kKeycode150 = 150, + kWlan = 151, + kPower = 152, + kAssistant = 153, + kKeycode154 = 154, + kKeycode155 = 155, + kKeycode156 = 156, + kKeycode157 = 157, + kKeycode158 = 158, + kKeycode159 = 159, + kLshift = 160, + kRshift = 161, + kLcontrol = 162, + kRcontrol = 163, + kLmenu = 164, + kRmenu = 165, + kBrowserBack = 166, + kBrowserForward = 167, + kBrowserRefresh = 168, + kBrowserStop = 169, + kBrowserSearch = 170, + kBrowserFavorites = 171, + kBrowserHome = 172, + kVolumeMute = 173, + kVolumeDown = 174, + kVolumeUp = 175, + kMediaNextTrack = 176, + kMediaPrevTrack = 177, + kMediaStop = 178, + kMediaPlayPause = 179, + kMediaLaunchMail = 180, + kMediaLaunchMediaSelect = 181, + kMediaLaunchApp1 = 182, + kMediaLaunchApp2 = 183, + kKeycode184 = 184, + kKeycode185 = 185, + kOem1 = 186, + kOemPlus = 187, + kOemComma = 188, + kOemMinus = 189, + kOemPeriod = 190, + kOem2 = 191, + kOem3 = 192, + kKeycode193 = 193, + kKeycode194 = 194, + kKeycode195 = 195, + kKeycode196 = 196, + kKeycode197 = 197, + kKeycode198 = 198, + kKeycode199 = 199, + kKeycode200 = 200, + kKeycode201 = 201, + kKeycode202 = 202, + kKeycode203 = 203, + kKeycode204 = 204, + kKeycode205 = 205, + kKeycode206 = 206, + kKeycode207 = 207, + kKeycode208 = 208, + kKeycode209 = 209, + kKeycode210 = 210, + kKeycode211 = 211, + kKeycode212 = 212, + kKeycode213 = 213, + kKeycode214 = 214, + kKeycode215 = 215, + kBrightnessDown = 216, + kBrightnessUp = 217, + kKbdBrightnessDown = 218, + kOem4 = 219, + kOem5 = 220, + kOem6 = 221, + kOem7 = 222, + kOem8 = 223, + kKeycode224 = 224, + kAltgr = 225, + kOem102 = 226, + kKeycode227 = 227, + kKeycode228 = 228, + kProcesskey = 229, + kCompose = 230, + kPacket = 231, + kKbdBrightnessUp = 232, + kKeycode233 = 233, + kKeycode234 = 234, + kKeycode235 = 235, + kKeycode236 = 236, + kKeycode237 = 237, + kKeycode238 = 238, + kKeycode239 = 239, + kKeycode240 = 240, + kKeycode241 = 241, + kKeycode242 = 242, + kDbeSbcschar = 243, + kDbeDbcschar = 244, + kKeycode245 = 245, + kAttn = 246, + kCrsel = 247, + kExsel = 248, + kEreof = 249, + kPlay = 250, + kZoom = 251, + kNoname = 252, + kPa1 = 253, + kOemClear = 254, + kKeycode255 = 255, + kNone = 256, + kMaxValue = kNone, }; -SwitchAccessCommandKeyCode UmaValueForKeyCode(int key_code) { - switch (key_code) { - case 0: - return SwitchAccessCommandKeyCode::kNone; - case 13: - return SwitchAccessCommandKeyCode::kEnter; - case 32: - return SwitchAccessCommandKeyCode::kSpace; - default: - return SwitchAccessCommandKeyCode::kUnknown; - } -} - void MigrateSwitchAccessKeyCodePref(PrefService* prefs, const std::string& old_pref, const std::string& new_pref) { @@ -1835,12 +2075,11 @@ void AccessibilityControllerImpl::UpdateSwitchAccessKeyCodesFromPref( std::string uma_name = UmaNameForSwitchAccessCommand(command); if (key_codes.size() == 0) { - SwitchAccessCommandKeyCode uma_value = UmaValueForKeyCode(0); - base::UmaHistogramEnumeration(uma_name, uma_value); + base::UmaHistogramEnumeration(uma_name, SwitchAccessKeyCode::kNone); } for (const auto& key_code : key_codes) { - SwitchAccessCommandKeyCode uma_value = UmaValueForKeyCode(key_code.first); - base::UmaHistogramEnumeration(uma_name, uma_value); + base::UmaHistogramEnumeration( + uma_name, static_cast(key_code.first)); } accessibility_event_rewriter_->SetKeyCodesForSwitchAccessCommand(key_codes, 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 2f2cc15bd276b2..12ced5efb7a930 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 @@ namespace ash { 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, DarkAndLightTheme) { } 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 b4b2baa25c664c..e02c537debdf1a 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 @@ class AssistantMainStageTest : public AssistantAshTestBase { }; 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 419e7501c8eacd..c410e9f004dcac 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, Theme) { 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, ThemeDarkLightMode) { } 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, PageViewHasBackgroundBlurInTabletMode) { 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/ash_strings.grd b/ash/ash_strings.grd index 0792adbbdffc00..33da35e6c11228 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd @@ -406,6 +406,9 @@ This file contains the strings for ash. Casting screen to $1Living Room + + Cast to a $1yourdomain.com device + Dark theme diff --git a/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_CAST_ACCESS_CAST_ADD.png.sha1 b/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_CAST_ACCESS_CAST_ADD.png.sha1 new file mode 100644 index 00000000000000..9f522e54b3a93e --- /dev/null +++ b/ash/ash_strings_grd/IDS_ASH_STATUS_TRAY_CAST_ACCESS_CAST_ADD.png.sha1 @@ -0,0 +1 @@ +0f8f03c66e4fc82a1a7a449861bff0b2b86eb148 \ No newline at end of file diff --git a/ash/assistant/assistant_controller_impl_unittest.cc b/ash/assistant/assistant_controller_impl_unittest.cc index 109bed5fac843d..9fac96b820e686 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 @@ TEST_F(AssistantControllerImplTest, ClosesAssistantUiForFeedbackDeeplink) { // 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, ColorModeIsSetWhenAssistantIsReadyFlagOff) { 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 1bc71ee800d02c..17f1d5c813c440 100644 --- a/ash/assistant/ui/DEPS +++ b/ash/assistant/ui/DEPS @@ -15,6 +15,7 @@ include_rules = [ "+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 7159e928adc5d1..e7f4858a5d9863 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 @@ namespace assistant { 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, AssistantColor) { } TEST_F(AssistantColorsUtilUnittest, AssistantColorFlagOff) { - ASSERT_FALSE(features::IsDarkLightModeEnabled()); + ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled()); EXPECT_EQ( ResolveAssistantColor(assistant_colors::ColorName::kBgAssistantPlate), @@ -55,7 +56,7 @@ TEST_F(AssistantColorsUtilUnittest, AssistantColorFlagOff) { // 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 9d5fabcca13342..a9b65797b30f78 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 @@ views::Label* GetLabel(AssistantOnboardingSuggestionView* suggestion_view) { 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 f92c721c7ec988..e6eee08e11f84b 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, ShouldHandleRemoteIcons) { } 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, DarkAndLightTheme) { } 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 58bb6dbf484d56..446ba2ae4264b8 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 @@ namespace { 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, ThemeDarkLightMode) { } 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 def24dabfd0f01..5b9a61f11eb16a 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 @@ constexpr char kTestString[] = "test"; 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 widget = CreateFramelessTestWidget(); @@ -52,7 +53,7 @@ TEST_F(AssistantTextElementViewTest, DarkAndLightTheme) { } TEST_F(AssistantTextElementViewTest, DarkAndLightModeFlagOff) { - ASSERT_FALSE(features::IsDarkLightModeEnabled()); + ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled()); std::unique_ptr 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 24a7c31a394a76..077167d213b81d 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 @@ namespace { using AssistantZeroStateViewUnittest = AssistantAshTestBase; TEST_F(AssistantZeroStateViewUnittest, Theme) { - ASSERT_FALSE(features::IsDarkLightModeEnabled()); + ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled()); ShowAssistantUi(); @@ -36,7 +36,8 @@ TEST_F(AssistantZeroStateViewUnittest, Theme) { } 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 a9b54801aeb20f..6b6ce70f5be0f8 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, ShouldHandleRemoteIcons) { } 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, DarkAndLightTheme) { } 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 55d7c4ab241ff7..ceb589b5388905 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 @@ constexpr char kResponseText[] = "Response"; 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, DarkAndLightTheme) { } TEST_F(UiElementContainerViewTest, DarkAndLightModeFlagOff) { - ASSERT_FALSE(features::IsDarkLightModeEnabled()); + ASSERT_FALSE(chromeos::features::IsDarkLightModeEnabled()); ShowAssistantUi(); diff --git a/ash/components/arc/mojom/screen_capture.mojom b/ash/components/arc/mojom/screen_capture.mojom index 7eca02695612ca..83901786ab2968 100644 --- a/ash/components/arc/mojom/screen_capture.mojom +++ b/ash/components/arc/mojom/screen_capture.mojom @@ -10,12 +10,13 @@ // The original version of this file lives in the Chromium repository at: // src/components/arc/mojom/screen_capture.mojom -// Next MinVersion: 2 +// Next MinVersion: 3 module arc.mojom; import "ash/components/arc/mojom/gfx.mojom"; import "ash/components/arc/mojom/video_common.mojom"; +import "ui/gfx/mojom/buffer_types.mojom"; // Implemented by Chrome in order to allow requesting of permissions to perform // desktop capture as well as creating a session for it. @@ -55,7 +56,22 @@ interface ScreenCaptureSession { // graphics_buffer should be a handle to the buffer which corresponds to the // surface being rendered to // stride is the stride in pixels for each row of the buffer - SetOutputBuffer@0(handle graphics_buffer, uint32 stride) => (); + // DEPRECATED: Please use SetOutputBuffer@1 instead. + SetOutputBufferDeprecated@0(handle graphics_buffer, uint32 stride) => (); + + // Called to set the graphics buffer that the screen capture should be + // rendered to. This call does not return until the rendering is complete to + // the passed in buffer. + // graphics_buffer should be a handle to the buffer which corresponds to the + // surface being rendered to + // buffer_format gives the general format of the buffer + // buffer_format_modifier is an additional buffer format modifier value + // (See DRM_FORMAT_MOD_* in drm_fourcc.h) + // stride is the stride in pixels for each row of the buffer + [MinVersion=2] SetOutputBuffer@1(handle graphics_buffer, + gfx.mojom.BufferFormat buffer_format, + uint64 buffer_format_modifier, + uint32 stride) => (); }; // Implemented by Android. diff --git a/ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc b/ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc index e0f7fbed81cb31..1e745240913533 100644 --- a/ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc +++ b/ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc @@ -26,6 +26,7 @@ #include "media/gpu/chromeos/video_decoder_pipeline.h" #include "media/gpu/gpu_video_decode_accelerator_factory.h" #include "media/gpu/macros.h" +#include "media/media_buildflags.h" #include "mojo/public/cpp/system/platform_handle.h" // Make sure arc::mojom::VideoDecodeAccelerator::Result and @@ -78,6 +79,16 @@ arc::mojom::VideoDecodeAccelerator::Result ConvertErrorCode( } } +media::VideoDecodeAccelerator::Config CreateVdaConfig( + media::VideoCodecProfile profile, + bool uses_vd) { + media::VideoDecodeAccelerator::Config vda_config(profile); + vda_config.output_mode = + media::VideoDecodeAccelerator::Config::OutputMode::IMPORT; + vda_config.is_deferred_initialization_allowed = uses_vd; + return vda_config; +} + } // namespace namespace arc { @@ -112,7 +123,7 @@ GpuArcVideoDecodeAccelerator::GpuArcVideoDecodeAccelerator( GpuArcVideoDecodeAccelerator::~GpuArcVideoDecodeAccelerator() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); weak_ptr_factory_for_querying_protected_input_buffers_.InvalidateWeakPtrs(); - weak_ptr_factory_for_querying_protected_output_buffers_.InvalidateWeakPtrs(); + weak_ptr_factory_.InvalidateWeakPtrs(); if (vda_) { // Destroy |vda_| now in case it needs to use *|this| during tear-down. @@ -312,13 +323,15 @@ void GpuArcVideoDecodeAccelerator::ExecuteRequest( mojom::VideoDecodeAccelerator::Result::PLATFORM_FAILURE); return; } - // When pending_reset_callback_ isn't null, GAVDA is awaiting a preceding + // When |pending_reset_callback_| isn't null, GAVDA is awaiting a preceding // Reset() to be finished. Any requests are pended. - // There is no need to take pending_flush_callbacks into account. + // When |pending_init_callback_| isn't null, GAVDA is awaiting a re-init to + // move the decoder into secure mode. + // There is no need to take |pending_flush_callbacks_| into account. // VDA::Reset() can be called while VDA::Flush() are being executed. // VDA::Flush()es can be called regardless of whether or not there is a // preceding VDA::Flush(). - if (pending_reset_callback_) { + if (pending_reset_callback_ || pending_init_callback_) { pending_requests_.emplace(std::move(request)); return; } @@ -358,14 +371,21 @@ void GpuArcVideoDecodeAccelerator::InitializeTask( mojom::VideoDecodeAccelerator::Result::INSUFFICIENT_RESOURCES); } - media::VideoDecodeAccelerator::Config vda_config(config->profile); + profile_ = config->profile; #if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) - vda_config.output_mode = - media::VideoDecodeAccelerator::Config::OutputMode::IMPORT; - - if (base::FeatureList::IsEnabled(arc::kVideoDecoder)) { + const bool use_vd = base::FeatureList::IsEnabled(arc::kVideoDecoder); +#if BUILDFLAG(USE_ARC_PROTECTED_MEDIA) + if (!use_vd) { + LOG(ERROR) << "Unsupported path: builds with USE_ARC_PROTECTED_MEDIA must " + "use the VideoDecoder"; + return OnInitializeDone( + mojom::VideoDecodeAccelerator::Result::PLATFORM_FAILURE); + } +#endif // BUILDFLAG(USE_ARC_PROTECTED_MEDIA) + media::VideoDecodeAccelerator::Config vda_config = + CreateVdaConfig(profile_, use_vd); + if (use_vd) { VLOGF(2) << "Using VideoDecoder-backed VdVideoDecodeAccelerator."; - vda_config.is_deferred_initialization_allowed = true; vda_ = media::VdVideoDecodeAccelerator::Create( base::BindRepeating(&media::VideoDecoderPipeline::Create), this, vda_config, base::SequencedTaskRunnerHandle::Get()); @@ -376,7 +396,7 @@ void GpuArcVideoDecodeAccelerator::InitializeTask( vda_ = vda_factory->CreateVDA(this, vda_config, gpu_workarounds_, gpu_preferences_); } -#endif +#endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) if (!vda_) { VLOGF(1) << "Failed to create VDA."; @@ -412,7 +432,7 @@ void GpuArcVideoDecodeAccelerator::NotifyInitializationComplete( void GpuArcVideoDecodeAccelerator::OnInitializeDone( mojom::VideoDecodeAccelerator::Result result) { - DVLOGF(4); + DVLOGF(4) << " result: " << result; DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (result != mojom::VideoDecodeAccelerator::Result::SUCCESS) @@ -422,6 +442,16 @@ void GpuArcVideoDecodeAccelerator::OnInitializeDone( UMA_HISTOGRAM_ENUMERATION( "Media.GpuArcVideoDecodeAccelerator.InitializeResult", result); std::move(pending_init_callback_).Run(result); + RunPendingRequests(); +} + +void GpuArcVideoDecodeAccelerator::OnReinitializeDone( + mojom::VideoDecodeAccelerator::Result result) { + DVLOGF(4) << " result: " << result; + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (result != mojom::VideoDecodeAccelerator::Result::SUCCESS) + client_->NotifyError(result); } void GpuArcVideoDecodeAccelerator::Decode( @@ -511,6 +541,24 @@ void GpuArcVideoDecodeAccelerator::ContinueDecode( weak_ptr_factory_for_querying_protected_input_buffers_ .GetWeakPtr())); } +#if BUILDFLAG(USE_ARC_PROTECTED_MEDIA) + if (*secure_mode_) { + VLOGF(2) << "Reinitializing decoder for secure mode"; + media::VideoDecodeAccelerator::Config vda_config = + CreateVdaConfig(profile_, true); + // TODO(jkardatzke): Properly set the encryption scheme when we + // implement this for Intel. For AMD it doesn't matter since it uses + // transcryption. + vda_config.encryption_scheme = media::EncryptionScheme::kCenc; + // Set a |pending_init_callback_| to force queueing up any incoming decode + // requests. + DCHECK(!pending_init_callback_); + pending_init_callback_ = + base::BindOnce(&GpuArcVideoDecodeAccelerator::OnReinitializeDone, + weak_ptr_factory_.GetWeakPtr()); + vda_->Initialize(vda_config, this); + } +#endif // BUILDFLAG(USE_ARC_PROTECTED_MEDIA) } if (!*secure_mode_) { @@ -689,9 +737,7 @@ void GpuArcVideoDecodeAccelerator::ImportBufferForPicture( std::move(handle_fd), base::BindOnce( &GpuArcVideoDecodeAccelerator::ContinueImportBufferForPicture, - weak_ptr_factory_for_querying_protected_output_buffers_ - .GetWeakPtr(), - picture_buffer_id, pixel_format)); + weak_ptr_factory_.GetWeakPtr(), picture_buffer_id, pixel_format)); } else { std::vector handle_fds = DuplicateFD(std::move(handle_fd), planes.size()); diff --git a/ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h b/ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h index 59cfaea21cbe66..abc2de26fb66f5 100644 --- a/ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h +++ b/ash/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h @@ -92,6 +92,8 @@ class GpuArcVideoDecodeAccelerator "The type of PendingCallback must match ResetCallback"); static_assert(std::is_same::value, "The type of PendingCallback must match FlushCallback"); + static_assert(std::is_same::value, + "The type of PendingCallback must match InitializeCallback"); using PendingRequest = base::OnceCallback; @@ -100,6 +102,8 @@ class GpuArcVideoDecodeAccelerator void InitializeTask(mojom::VideoDecodeAcceleratorConfigPtr config); // Called when initialization is done. void OnInitializeDone(mojom::VideoDecodeAccelerator::Result result); + // Proxy callback for re-initialize in encrypted mode in the case of error. + void OnReinitializeDone(mojom::VideoDecodeAccelerator::Result result); // Called after getting the input shared memory region from the // |protected_buffer_manager_|, if required. Otherwise, Decode() calls this @@ -127,11 +131,12 @@ class GpuArcVideoDecodeAccelerator void RunPendingRequests(); // When |pending_reset_callback_| isn't null, GAVDA is awaiting a preceding - // Reset() to be finished, and |request| is pended by queueing - // in |pending_requests_|. Otherwise, the requested VDA operation is executed. - // In the case of Flush request, the callback is queued to - // |pending_flush_callbacks_|. In the case of Reset request, - // the callback is set |pending_reset_callback_|. + // Reset() to be finished. When |pending_init_callback_| isn't null, GAVDA is + // awaiting a re-init to move the decoder into secure mode. In both cases + // |request| is pended by queueing in |pending_requests_|. Otherwise, the + // requested VDA operation is executed. In the case of Flush request, the + // callback is queued to |pending_flush_callbacks_|. In the case of Reset + // request, the callback is set |pending_reset_callback_|. void ExecuteRequest(std::pair request); // Requested VDA methods are executed in these functions. @@ -172,12 +177,15 @@ class GpuArcVideoDecodeAccelerator // The variables for managing callbacks. // VDA::Decode(), VDA::Flush() and VDA::Reset() should not be posted to VDA // while the previous Reset() hasn't been finished yet (i.e. before - // NotifyResetDone() is invoked). - // Those requests will be queued in |pending_requests_| in a FIFO manner, - // and will be executed once all the preceding Reset() have been finished. + // NotifyResetDone() is invoked). Same thing goes for when we are + // re-initializing to enter secure mode. Those requests will be queued in + // |pending_requests_| in a FIFO manner, and will be executed once all the + // preceding Reset() or Initialize() have been finished. // |pending_flush_callbacks_| stores all the callbacks corresponding to // currently executing Flush()es in VDA. |pending_reset_callback_| is a // callback of the currently executing Reset() in VDA. + // |pending_init_callback_| is a callback of the currently executing Create() + // or re-execution of Initialize() for the decoder. // If |pending_flush_callbacks_| is not empty in NotifyResetDone(), // as Flush()es may be cancelled by Reset() in VDA, they are called with // CANCELLED. @@ -196,6 +204,7 @@ class GpuArcVideoDecodeAccelerator gfx::Size coded_size_; gfx::Size pending_coded_size_; + media::VideoCodecProfile profile_ = media::VIDEO_CODEC_PROFILE_UNKNOWN; scoped_refptr protected_buffer_manager_; @@ -222,10 +231,11 @@ class GpuArcVideoDecodeAccelerator THREAD_CHECKER(thread_checker_); + // The one for input buffers lives until ResetRequest(). base::WeakPtrFactory weak_ptr_factory_for_querying_protected_input_buffers_{this}; - base::WeakPtrFactory - weak_ptr_factory_for_querying_protected_output_buffers_{this}; + // This one lives for the lifetime of the object. + base::WeakPtrFactory weak_ptr_factory_{this}; }; } // namespace arc diff --git a/ash/components/arc/video_accelerator/protected_buffer_manager.cc b/ash/components/arc/video_accelerator/protected_buffer_manager.cc index 61822058f3d9c9..b9271793c7030d 100644 --- a/ash/components/arc/video_accelerator/protected_buffer_manager.cc +++ b/ash/components/arc/video_accelerator/protected_buffer_manager.cc @@ -16,6 +16,7 @@ #include "base/system/sys_info.h" #include "base/threading/thread_checker.h" #include "media/gpu/macros.h" +#include "media/media_buildflags.h" #include "ui/gfx/geometry/size.h" #include "ui/ozone/public/ozone_platform.h" #include "ui/ozone/public/surface_factory_ozone.h" @@ -162,7 +163,11 @@ ProtectedBufferManager::ProtectedNativePixmap::Create( ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); protected_pixmap->native_pixmap_ = factory->CreateNativePixmap( gfx::kNullAcceleratedWidget, VK_NULL_HANDLE, size, format, +#if BUILDFLAG(USE_ARC_PROTECTED_MEDIA) + gfx::BufferUsage::PROTECTED_SCANOUT_VDA_WRITE); +#else gfx::BufferUsage::SCANOUT_VDA_WRITE); +#endif // BUILDFLAG(USE_ARC_PROTECTED_MEDIA) if (!protected_pixmap->native_pixmap_) { VLOGF(1) << "Failed allocating a native pixmap"; diff --git a/ash/components/phonehub/camera_roll_manager_impl.cc b/ash/components/phonehub/camera_roll_manager_impl.cc index 3bf3188ad08793..c5de006009d81e 100644 --- a/ash/components/phonehub/camera_roll_manager_impl.cc +++ b/ash/components/phonehub/camera_roll_manager_impl.cc @@ -159,8 +159,7 @@ void CameraRollManagerImpl::OnPhoneStatusSnapshotReceived( proto::PhoneStatusSnapshot phone_status_snapshot) { UpdateCameraRollAccessStateAndNotifyIfNeeded( phone_status_snapshot.properties().camera_roll_access_state()); - if (!is_android_feature_enabled_ || !is_android_storage_granted_ || - !IsCameraRollSettingEnabled()) { + if (!is_android_storage_granted_ || !IsCameraRollSettingEnabled()) { ClearCurrentItems(); CancelPendingThumbnailRequests(); resetViewRefreshingFlagIfNeeded(); @@ -174,8 +173,7 @@ void CameraRollManagerImpl::OnPhoneStatusUpdateReceived( proto::PhoneStatusUpdate phone_status_update) { UpdateCameraRollAccessStateAndNotifyIfNeeded( phone_status_update.properties().camera_roll_access_state()); - if (!is_android_feature_enabled_ || !is_android_storage_granted_ || - !IsCameraRollSettingEnabled()) { + if (!is_android_storage_granted_ || !IsCameraRollSettingEnabled()) { ClearCurrentItems(); CancelPendingThumbnailRequests(); resetViewRefreshingFlagIfNeeded(); @@ -261,12 +259,8 @@ void CameraRollManagerImpl::OnFeatureStatesChanged( void CameraRollManagerImpl::UpdateCameraRollAccessStateAndNotifyIfNeeded( const proto::CameraRollAccessState& access_state) { - bool updated_feature_enabled = access_state.feature_enabled(); bool updated_storage_granted = access_state.storage_permission_granted(); - - if (is_android_feature_enabled_ != updated_feature_enabled || - is_android_storage_granted_ != updated_storage_granted) { - is_android_feature_enabled_ = updated_feature_enabled; + if (is_android_storage_granted_ != updated_storage_granted) { is_android_storage_granted_ = updated_storage_granted; util::LogCameraRollAndroidHasStorageAccessPermission( @@ -282,11 +276,7 @@ void CameraRollManagerImpl::OnCameraRollOnboardingUiDismissed() { } void CameraRollManagerImpl::ComputeAndUpdateUiState() { - if (!is_android_feature_enabled_) { - ui_state_ = CameraRollUiState::SHOULD_HIDE; - NotifyCameraRollViewUiStateUpdated(); - return; - } else if (!is_android_storage_granted_) { + if (!is_android_storage_granted_) { ui_state_ = CameraRollUiState::NO_STORAGE_PERMISSION; NotifyCameraRollViewUiStateUpdated(); return; diff --git a/ash/components/phonehub/camera_roll_manager_impl_unittest.cc b/ash/components/phonehub/camera_roll_manager_impl_unittest.cc index 8ec136d525472b..7a52b81ea1b857 100644 --- a/ash/components/phonehub/camera_roll_manager_impl_unittest.cc +++ b/ash/components/phonehub/camera_roll_manager_impl_unittest.cc @@ -360,7 +360,6 @@ TEST_F(CameraRollManagerImplTest, update.set_has_camera_roll_updates(false); proto::CameraRollAccessState* access_state = update.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); @@ -376,7 +375,6 @@ TEST_F(CameraRollManagerImplTest, update.set_has_camera_roll_updates(true); proto::CameraRollAccessState* access_state = update.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); @@ -401,7 +399,6 @@ TEST_F(CameraRollManagerImplTest, update.set_has_camera_roll_updates(true); proto::CameraRollAccessState* access_state = update.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); @@ -422,28 +419,6 @@ TEST_F(CameraRollManagerImplTest, GetSentFetchCameraRollItemsRequest().current_item_metadata(2)); } -TEST_F(CameraRollManagerImplTest, - OnPhoneStatusUpdateReceivedWithFeatureDisabled) { - proto::FetchCameraRollItemsResponse response; - PopulateItemProto(response.add_items(), "key2"); - PopulateItemProto(response.add_items(), "key1"); - fake_message_receiver_.NotifyFetchCameraRollItemsResponseReceived(response); - CompleteThumbnailDecoding(BatchDecodeResult::kSuccess); - - proto::PhoneStatusUpdate update; - proto::CameraRollAccessState* access_state = - update.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(false); - access_state->set_storage_permission_granted(true); - fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); - - EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); - EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, - camera_roll_manager()->ui_state()); - EXPECT_EQ(3, GetOnCameraRollViewUiStateUpdatedCallCount()); - EXPECT_EQ(0, GetCurrentItemsCount()); -} - TEST_F(CameraRollManagerImplTest, OnPhoneStatusUpdateReceivedWithCameraRollSettingsDisabled) { SetCameraRollFeatureState(FeatureState::kDisabledByUser); @@ -457,7 +432,6 @@ TEST_F(CameraRollManagerImplTest, update.set_has_camera_roll_updates(true); proto::CameraRollAccessState* access_state = update.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); @@ -479,14 +453,13 @@ TEST_F(CameraRollManagerImplTest, proto::PhoneStatusUpdate update; proto::CameraRollAccessState* access_state = update.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(false); fake_message_receiver_.NotifyPhoneStatusUpdateReceived(update); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); EXPECT_EQ(CameraRollManager::CameraRollUiState::NO_STORAGE_PERMISSION, camera_roll_manager()->ui_state()); - EXPECT_EQ(3, GetOnCameraRollViewUiStateUpdatedCallCount()); + EXPECT_EQ(2, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } @@ -494,7 +467,6 @@ TEST_F(CameraRollManagerImplTest, OnPhoneStatusSnapshotReceived) { proto::PhoneStatusSnapshot snapshot; proto::CameraRollAccessState* access_state = snapshot.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); @@ -504,28 +476,6 @@ TEST_F(CameraRollManagerImplTest, OnPhoneStatusSnapshotReceived) { EXPECT_EQ(1, GetOnCameraRollViewUiStateUpdatedCallCount()); } -TEST_F(CameraRollManagerImplTest, - OnPhoneStatusSnapshotReceivedWithFeatureDisabled) { - proto::FetchCameraRollItemsResponse response; - PopulateItemProto(response.add_items(), "key2"); - PopulateItemProto(response.add_items(), "key1"); - fake_message_receiver_.NotifyFetchCameraRollItemsResponseReceived(response); - CompleteThumbnailDecoding(BatchDecodeResult::kSuccess); - - proto::PhoneStatusSnapshot snapshot; - proto::CameraRollAccessState* access_state = - snapshot.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(false); - access_state->set_storage_permission_granted(true); - fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); - - EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); - EXPECT_EQ(CameraRollManager::CameraRollUiState::SHOULD_HIDE, - camera_roll_manager()->ui_state()); - EXPECT_EQ(3, GetOnCameraRollViewUiStateUpdatedCallCount()); - EXPECT_EQ(0, GetCurrentItemsCount()); -} - TEST_F(CameraRollManagerImplTest, OnPhoneStatusSnapshotReceivedWithCameraRollSettingDisabled) { SetCameraRollFeatureState(FeatureState::kDisabledByUser); @@ -538,7 +488,6 @@ TEST_F(CameraRollManagerImplTest, proto::PhoneStatusSnapshot snapshot; proto::CameraRollAccessState* access_state = snapshot.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); @@ -560,14 +509,13 @@ TEST_F(CameraRollManagerImplTest, proto::PhoneStatusSnapshot snapshot; proto::CameraRollAccessState* access_state = snapshot.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(false); fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); EXPECT_EQ(0UL, GetSentFetchCameraRollItemsRequestCount()); EXPECT_EQ(CameraRollManager::CameraRollUiState::NO_STORAGE_PERMISSION, camera_roll_manager()->ui_state()); - EXPECT_EQ(3, GetOnCameraRollViewUiStateUpdatedCallCount()); + EXPECT_EQ(2, GetOnCameraRollViewUiStateUpdatedCallCount()); EXPECT_EQ(0, GetCurrentItemsCount()); } @@ -575,7 +523,6 @@ TEST_F(CameraRollManagerImplTest, OnFeatureOnFeatureStatesChangedToDisabled) { proto::PhoneStatusSnapshot snapshot; proto::CameraRollAccessState* access_state = snapshot.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); proto::FetchCameraRollItemsResponse response; @@ -598,7 +545,6 @@ TEST_F(CameraRollManagerImplTest, FeatureProhibitedByPolicy) { proto::PhoneStatusSnapshot snapshot; proto::CameraRollAccessState* access_state = snapshot.mutable_properties()->mutable_camera_roll_access_state(); - access_state->set_feature_enabled(true); access_state->set_storage_permission_granted(true); fake_message_receiver_.NotifyPhoneStatusSnapshotReceived(snapshot); diff --git a/ash/components/phonehub/proto/phonehub_api.proto b/ash/components/phonehub/proto/phonehub_api.proto index d1c53da8a93c48..a01b102190ffb9 100644 --- a/ash/components/phonehub/proto/phonehub_api.proto +++ b/ash/components/phonehub/proto/phonehub_api.proto @@ -122,7 +122,9 @@ enum ScreenLockState { // device message CameraRollAccessState { // Whether the camera roll feature is enabled - bool feature_enabled = 1; + // DEPRECATED: this is now checked during CryptAuth enrollment on the Android + // device and no longer checked by the Phone Hub CrOS code. + bool feature_enabled = 1 [deprecated = true]; // Whether necessary storage permissions have been granted to access camera // roll items bool storage_permission_granted = 2; diff --git a/ash/constants/BUILD.gn b/ash/constants/BUILD.gn index ebcd13a48ca897..bbf5dab22aabe9 100644 --- a/ash/constants/BUILD.gn +++ b/ash/constants/BUILD.gn @@ -26,6 +26,7 @@ component("constants") { ] public_deps = [ "//base", + "//chromeos/constants", "//skia", "//third_party/abseil-cpp:absl", ] diff --git a/ash/constants/DEPS b/ash/constants/DEPS index 0eda6c8406a296..6a392523a8299b 100644 --- a/ash/constants/DEPS +++ b/ash/constants/DEPS @@ -5,6 +5,7 @@ include_rules = [ "+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 2cf5855025288e..acf18902dc7702 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 kCryptAuthV2Enrollment{"CryptAuthV2Enrollment", 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 IsCryptohomeRecoveryFlowEnabled() { } 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 b34e0828dd32f1..56d9c8b6a71406 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h @@ -152,7 +152,6 @@ COMPONENT_EXPORT(ASH_CONSTANTS) 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/constants/ash_pref_names.cc b/ash/constants/ash_pref_names.cc index c5b4eb38df0159..6cc5ced7022f54 100644 --- a/ash/constants/ash_pref_names.cc +++ b/ash/constants/ash_pref_names.cc @@ -876,18 +876,32 @@ const char kPreconfiguredDeskTemplates[] = "ash.preconfigured_desk_templates"; // A boolean pref that tracks whether the user has enabled Projector creation // flow during onboarding. const char kProjectorCreationFlowEnabled[] = - "ash.projector.creationFlowEnabled"; + "ash.projector.creation_flow_enabled"; + +// A string pref that tracks the language installed for the Projector creation +// flow. +const char kProjectorCreationFlowLanguage[] = + "ash.projector.creation_flow_language"; + +// An integer pref counting the number of times the Onboarding flow has been +// shown to the user inside the Projector Gallery. +const char kProjectorGalleryOnboardingShowCount[] = + "ash.projector.gallery_onboarding_show_count"; + +// An integer pref counting the number of times the Onboarding flow has been +// shown to the user inside the Projector Viewer. +const char kProjectorViewerOnboardingShowCount[] = + "ash.projector.viewer_onboarding_show_count"; + +// A boolean pref that indicates the Projector has been enabled by admin +// policy. +const char kProjectorAllowByPolicy[] = "ash.projector.allow_by_policy"; // A boolean pref that indicates whether the migration of Chromad devices to // cloud management can be started. const char kChromadToCloudMigrationEnabled[] = "ash.chromad_to_cloud_migration_enabled"; -// A string pref that tracks the language installed for the Projector creation -// flow. -const char kProjectorCreationFlowLanguage[] = - "ash.projector.creationFlowLanguage"; - // List of Drive Folder Shortcuts in the Files app. Used to sync the shortcuts // across devices. const char kFilesAppFolderShortcuts[] = "ash.filesapp.folder_shortcuts"; @@ -896,16 +910,6 @@ const char kFilesAppFolderShortcuts[] = "ash.filesapp.folder_shortcuts"; // the Chrome app to System Web App. const char kFilesAppUIPrefsMigrated[] = "ash.filesapp.ui_prefs_migrated"; -// An integer pref counting the number of times the Onboarding flow has been -// shown to the user inside the Projector Gallery. -const char kProjectorGalleryOnboardingShowCount[] = - "ash.projector.galleryOnboardingShowCount"; - -// An integer pref counting the number of times the Onboarding flow has been -// shown to the user inside the Projector Viewer. -const char kProjectorViewerOnboardingShowCount[] = - "ash.projector.viewerOnboardingShowCount"; - // Boolean value for the DeviceLoginScreenWebUILazyLoading device policy. const char kLoginScreenWebUILazyLoading[] = "ash.login.LoginScreenWebUILazyLoading"; diff --git a/ash/constants/ash_pref_names.h b/ash/constants/ash_pref_names.h index bed1800cca788e..81a82eeb8eb452 100644 --- a/ash/constants/ash_pref_names.h +++ b/ash/constants/ash_pref_names.h @@ -401,22 +401,25 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kPreconfiguredDeskTemplates[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kProjectorCreationFlowEnabled[]; -COMPONENT_EXPORT(ASH_CONSTANTS) -extern const char kChromadToCloudMigrationEnabled[]; - COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kProjectorCreationFlowLanguage[]; -COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kFilesAppFolderShortcuts[]; - -COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kFilesAppUIPrefsMigrated[]; - COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kProjectorGalleryOnboardingShowCount[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kProjectorViewerOnboardingShowCount[]; +COMPONENT_EXPORT(ASH_CONSTANTS) +extern const char kProjectorAllowByPolicy[]; + +COMPONENT_EXPORT(ASH_CONSTANTS) +extern const char kChromadToCloudMigrationEnabled[]; + +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kFilesAppFolderShortcuts[]; + +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kFilesAppUIPrefsMigrated[]; + COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kLoginScreenWebUILazyLoading[]; diff --git a/ash/style/ash_color_provider_unittests.cc b/ash/style/ash_color_provider_unittests.cc index df6e6d77e943c9..dd85bf366dbcd4 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 @@ TEST_F(AshColorProviderTest, ColorModeInNonActiveUserSessions) { // 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 @@ TEST_F(AshColorProviderTest, ColorModeInNonActiveUserSessions) { // 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/system/cast/tray_cast.cc b/ash/system/cast/tray_cast.cc index ff0313347fe6fc..369feb85f08f51 100644 --- a/ash/system/cast/tray_cast.cc +++ b/ash/system/cast/tray_cast.cc @@ -11,12 +11,16 @@ #include "ash/metrics/user_metrics_recorder.h" #include "ash/public/cpp/ash_view_ids.h" +#include "ash/public/cpp/system_tray_client.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" +#include "ash/system/model/enterprise_domain_model.h" +#include "ash/system/model/system_tray_model.h" #include "ash/system/tray/hover_highlight_view.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_detailed_view.h" +#include "base/metrics/user_metrics.h" #include "base/strings/utf_string_conversions.h" #include "build/branding_buildflags.h" #include "ui/base/l10n/l10n_util.h" @@ -120,6 +124,19 @@ void CastDetailedView::UpdateReceiverListFromCachedData() { view_to_sink_map_[container] = sink.id; } + if (CastConfigController::Get()->AccessCodeCastingEnabled()) { + EnterpriseDomainModel* enterprise_domain = + Shell::Get()->system_tray_model()->enterprise_domain(); + const std::string& org_name = enterprise_domain->account_domain_manager(); + DCHECK(!org_name.empty()) + << "account_domain_manager should not be empty when user is managed!"; + add_access_code_device_ = AddScrollListItem( + // TODO(b/209720161): replace with plus button icon when UI is final. + SinkIconTypeToIcon(SinkIconType::kGeneric), + l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_CAST_ACCESS_CAST_ADD, + base::UTF8ToUTF16(org_name))); + } + scroll_content()->SizeToPreferredSize(); scroller()->Layout(); } @@ -131,6 +148,10 @@ void CastDetailedView::HandleViewClicked(views::View* view) { CastConfigController::Get()->CastToSink(it->second); Shell::Get()->metrics()->RecordUserMetricsAction( UMA_STATUS_AREA_DETAILED_CAST_VIEW_LAUNCH_CAST); + } else if (view == add_access_code_device_) { + base::RecordAction(base::UserMetricsAction( + "StatusArea_Cast_Detailed_Launch_AccesCastDialog")); + Shell::Get()->system_tray_model()->client()->ShowAccessCodeCastingDialog(); } } diff --git a/ash/system/cast/tray_cast.h b/ash/system/cast/tray_cast.h index c997bda8a495fd..5b895fb871f703 100644 --- a/ash/system/cast/tray_cast.h +++ b/ash/system/cast/tray_cast.h @@ -45,6 +45,9 @@ class CastDetailedView : public TrayDetailedView, std::map sinks_and_routes_; // A mapping from the view pointer to the associated activity sink id. std::map view_to_sink_map_; + + // Special list item that, if clicked, launches the access code casting dialog + views::View* add_access_code_device_ = nullptr; }; } // namespace tray diff --git a/ash/wallpaper/wallpaper_controller_unittest.cc b/ash/wallpaper/wallpaper_controller_unittest.cc index e8b6c17a1b2357..5529a973302e79 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 @@ class WallpaperControllerWallpaperWebUiTest void SetUp() override { scoped_feature_list_.InitWithFeatures( {features::kWallpaperWebUI, features::kWallpaperFullScreenPreview, - features::kDarkLightMode}, + chromeos::features::kDarkLightMode}, {}); WallpaperControllerTestBase::SetUp(); } diff --git a/ash/wm/desks/desk_mini_view.cc b/ash/wm/desks/desk_mini_view.cc index 53d5d908704b73..3b0b7978699417 100644 --- a/ash/wm/desks/desk_mini_view.cc +++ b/ash/wm/desks/desk_mini_view.cc @@ -487,9 +487,16 @@ void DeskMiniView::LayoutDeskNameView(const gfx::Rect& preview_bounds) { const gfx::Size desk_name_view_size = desk_name_view_->GetPreferredSize(); // Desk preview's width is supposed to be larger than kMinDeskNameViewWidth, // but it might be not the truth for tests with extreme abnormal size of - // display. - const int min_width = std::min(preview_bounds.width(), kMinDeskNameViewWidth); - const int max_width = std::max(preview_bounds.width(), kMinDeskNameViewWidth); + // display. The preview uses a border to display focus and the name view uses + // a focus ring (which does not inset the view), so subtract the focus ring + // from the size calculations so that the focus UI is aligned. + views::FocusRing* focus_ring = views::FocusRing::Get(desk_name_view_); + const int focus_ring_length = + focus_ring->halo_thickness() - focus_ring->halo_inset(); + const int min_width = std::min(preview_bounds.width() - focus_ring_length, + kMinDeskNameViewWidth); + const int max_width = std::max(preview_bounds.width() - focus_ring_length, + kMinDeskNameViewWidth); const int text_width = base::clamp(desk_name_view_size.width(), min_width, max_width); const int desk_name_view_x = @@ -497,7 +504,7 @@ void DeskMiniView::LayoutDeskNameView(const gfx::Rect& preview_bounds) { gfx::Rect desk_name_view_bounds{desk_name_view_x, preview_bounds.bottom() - GetPreviewBorderInsets().bottom() + - kLabelPreviewSpacing, + kLabelPreviewSpacing + focus_ring_length, text_width, desk_name_view_size.height()}; desk_name_view_->SetBoundsRect(desk_name_view_bounds); diff --git a/ash/wm/desks/desk_name_view.cc b/ash/wm/desks/desk_name_view.cc index 9bdac2efb52ef2..b21ec689e4245d 100644 --- a/ash/wm/desks/desk_name_view.cc +++ b/ash/wm/desks/desk_name_view.cc @@ -20,6 +20,8 @@ namespace ash { namespace { +constexpr int kDeskNameViewHorizontalPadding = 6; + bool IsDesksBarWidget(const views::Widget* widget) { if (!widget) return false; @@ -39,7 +41,10 @@ bool IsDesksBarWidget(const views::Widget* widget) { } // namespace -DeskNameView::DeskNameView(DeskMiniView* mini_view) : mini_view_(mini_view) {} +DeskNameView::DeskNameView(DeskMiniView* mini_view) : mini_view_(mini_view) { + SetBorder( + views::CreateEmptyBorder(gfx::Insets(0, kDeskNameViewHorizontalPadding))); +} DeskNameView::~DeskNameView() = default; diff --git a/ash/wm/desks/desks_textfield.cc b/ash/wm/desks/desks_textfield.cc index 63c158f56fa892..9675a9a7c007a2 100644 --- a/ash/wm/desks/desks_textfield.cc +++ b/ash/wm/desks/desks_textfield.cc @@ -12,25 +12,27 @@ #include "ui/gfx/text_elider.h" #include "ui/views/accessibility/accessibility_paint_checks.h" #include "ui/views/background.h" +#include "ui/views/controls/focus_ring.h" +#include "ui/views/controls/highlight_path_generator.h" #include "ui/views/native_cursor.h" namespace ash { namespace { -constexpr int kDesksTextfieldMinHeight = 24; -constexpr int kDesksTextfieldHorizontalPadding = 6; +// The border radius on the text field. +constexpr int kDesksTextfieldBorderRadius = 4; + +constexpr int kDesksTextfieldMinHeight = 16; + +// Inset for the focus ring around the textfield. +constexpr int kFocusRingHaloInset = -2; } // namespace DesksTextfield::DesksTextfield() { - auto border = std::make_unique( - kDesksTextfieldBorderRadius, - gfx::Insets(0, kDesksTextfieldHorizontalPadding)); - border_ptr_ = border.get(); - views::Builder(this) - .SetBorder(std::move(border)) + .SetBorder(nullptr) .SetCursorEnabled(true) .SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_CENTER) // TODO(crbug.com/1218186): Remove this, this is in place temporarily to @@ -38,12 +40,22 @@ DesksTextfield::DesksTextfield() { // to add a name so that the screen reader knows what to announce. .SetProperty(views::kSkipAccessibilityPaintChecks, true) .BuildChildren(); + + views::FocusRing::Install(this); + views::FocusRing* focus_ring = views::FocusRing::Get(this); + focus_ring->SetHasFocusPredicate([](views::View* view) { + return static_cast(view)->IsViewHighlighted() || + view->HasFocus(); + }); + focus_ring->SetHaloInset(kFocusRingHaloInset); + focus_ring->SetPathGenerator( + std::make_unique( + gfx::Insets(), kDesksTextfieldBorderRadius)); } DesksTextfield::~DesksTextfield() = default; // static -constexpr size_t DesksTextfield::kDesksTextfieldBorderRadius; constexpr size_t DesksTextfield::kMaxLength; void DesksTextfield::SetTextAndElideIfNeeded(const std::u16string& text) { @@ -58,7 +70,7 @@ void DesksTextfield::SetTextAndElideIfNeeded(const std::u16string& text) { void DesksTextfield::UpdateViewAppearance() { background()->SetNativeControlColor(GetBackgroundColor()); - UpdateBorderState(); + UpdateFocusRingState(); } gfx::Size DesksTextfield::CalculatePreferredSize() const { @@ -74,6 +86,12 @@ gfx::Size DesksTextfield::CalculatePreferredSize() const { return size; } +void DesksTextfield::SetBorder(std::unique_ptr b) { + // `views::Textfield` override of `SetBorder()` removes an installed focus + // ring, which we want to keep. + views::View::SetBorder(std::move(b)); +} + bool DesksTextfield::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { // The default behavior of the tab key is that it moves the focus to the next // available view. @@ -108,7 +126,11 @@ void DesksTextfield::OnThemeChanged() { const SkColor selection_color = color_provider->GetControlsLayerColor( AshColorProvider::ControlsLayerType::kFocusAuraColor); SetSelectionBackgroundColor(selection_color); - UpdateBorderState(); + + views::FocusRing::Get(this)->SetColor(color_provider->GetControlsLayerColor( + AshColorProvider::ControlsLayerType::kFocusRingColor)); + + UpdateFocusRingState(); } gfx::NativeCursor DesksTextfield::GetCursor(const ui::MouseEvent& event) { @@ -128,16 +150,17 @@ void DesksTextfield::MaybeCloseHighlightedView() {} void DesksTextfield::MaybeSwapHighlightedView(bool right) {} void DesksTextfield::OnViewHighlighted() { - UpdateBorderState(); + UpdateFocusRingState(); } void DesksTextfield::OnViewUnhighlighted() { - UpdateBorderState(); + UpdateFocusRingState(); } -void DesksTextfield::UpdateBorderState() { - border_ptr_->SetFocused(IsViewHighlighted() || HasFocus()); - SchedulePaint(); +void DesksTextfield::UpdateFocusRingState() { + views::FocusRing* focus_ring = views::FocusRing::Get(this); + DCHECK(focus_ring); + focus_ring->SchedulePaint(); } SkColor DesksTextfield::GetBackgroundColor() const { diff --git a/ash/wm/desks/desks_textfield.h b/ash/wm/desks/desks_textfield.h index 2eeac377177d45..9ed8c6abc93ec7 100644 --- a/ash/wm/desks/desks_textfield.h +++ b/ash/wm/desks/desks_textfield.h @@ -7,7 +7,6 @@ #include "ash/ash_export.h" #include "ash/wm/overview/overview_highlightable_view.h" -#include "ash/wm/wm_highlight_item_border.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/textfield/textfield.h" @@ -27,9 +26,6 @@ class ASH_EXPORT DesksTextfield : public views::Textfield, DesksTextfield& operator=(const DesksTextfield&) = delete; ~DesksTextfield() override; - // The border radius on the text field. - static constexpr size_t kDesksTextfieldBorderRadius = 4; - // The max number of characters (UTF-16) allowed for the textfield. static constexpr size_t kMaxLength = 300; @@ -44,6 +40,7 @@ class ASH_EXPORT DesksTextfield : public views::Textfield, // views::View: gfx::Size CalculatePreferredSize() const override; + void SetBorder(std::unique_ptr b) override; bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void OnMouseEntered(const ui::MouseEvent& event) override; @@ -60,15 +57,11 @@ class ASH_EXPORT DesksTextfield : public views::Textfield, void OnViewUnhighlighted() override; protected: - // Owned by this View via `View::border_`. This is just a convenient pointer - // to it. - WmHighlightItemBorder* border_ptr_; - // Full text without being elided. std::u16string full_text_; private: - void UpdateBorderState(); + void UpdateFocusRingState(); // Returns the background color for this view based on whether it has focus // and if the mouse is entering/exiting the view. diff --git a/ash/wm/desks/expanded_desks_bar_button.cc b/ash/wm/desks/expanded_desks_bar_button.cc index cdf6f7240be372..4c6c9b20530f14 100644 --- a/ash/wm/desks/expanded_desks_bar_button.cc +++ b/ash/wm/desks/expanded_desks_bar_button.cc @@ -16,6 +16,7 @@ #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_highlight_controller.h" #include "ash/wm/overview/overview_session.h" +#include "ash/wm/wm_highlight_item_border.h" #include "ui/compositor/layer.h" #include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/text_elider.h" diff --git a/ash/wm/desks/templates/desks_templates_name_view.cc b/ash/wm/desks/templates/desks_templates_name_view.cc index cdfafb187fa2db..f4e1494d4e976a 100644 --- a/ash/wm/desks/templates/desks_templates_name_view.cc +++ b/ash/wm/desks/templates/desks_templates_name_view.cc @@ -42,17 +42,8 @@ bool IsDesksTemplatesGridWidget(const views::Widget* widget) { } // namespace DesksTemplatesNameView::DesksTemplatesNameView() { - // TODO(richui): We need to shift the alignment of the `name_view_` in the - // `DesksTemplatesItemView` so that the text lines up with the other UI - // elements. This will be done by refactoring `WmHighlightItemBorder` to - // adjust the border, which we update here. - auto border = std::make_unique( - DesksTextfield::kDesksTextfieldBorderRadius); - border_ptr_ = border.get(); - views::Builder(this) .SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT) - .SetBorder(std::move(border)) .BuildChildren(); SetFontList(GetFontList().Derive(kNameFontSizeDeltaDp, gfx::Font::NORMAL, diff --git a/base/android/java/src/org/chromium/base/task/AsyncTask.java b/base/android/java/src/org/chromium/base/task/AsyncTask.java index 8cfee1d4a9419f..099c36db73d4bc 100644 --- a/base/android/java/src/org/chromium/base/task/AsyncTask.java +++ b/base/android/java/src/org/chromium/base/task/AsyncTask.java @@ -156,6 +156,20 @@ private void postResult(Result result) { return mStatus; } + /** + * Returns the current status of this task, with adjustments made to make UMA more useful. + * Namely, we are going to return "PENDING" until the asynctask actually starts running. Right + * now, as soon as you try to schedule the AsyncTask, it gets set to "RUNNING" which doesn't + * make sense. However, we aren't fixing this globally as this is the well-defined API + * AsyncTasks have, so we are just fixing this for our UMA reporting. + * + * @return The current status. + */ + public final @Status int getUmaStatus() { + if (mStatus == Status.RUNNING && !mTaskInvoked.get()) return Status.PENDING; + return mStatus; + } + /** * Override this method to perform a computation on a background thread. * @@ -294,7 +308,7 @@ public final boolean cancel(boolean mayInterruptIfRunning) { @SuppressWarnings("NoDynamicStringsInTraceEventCheck") public final Result get() throws InterruptedException, ExecutionException { Result r; - int status = getStatus(); + int status = getUmaStatus(); if (status != Status.FINISHED && ThreadUtils.runningOnUiThread()) { RecordHistogram.recordEnumeratedHistogram( GET_STATUS_UMA_HISTOGRAM, status, Status.NUM_ENTRIES); @@ -332,7 +346,7 @@ public final Result get() throws InterruptedException, ExecutionException { public final Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { Result r; - int status = getStatus(); + int status = getUmaStatus(); if (status != Status.FINISHED && ThreadUtils.runningOnUiThread()) { RecordHistogram.recordEnumeratedHistogram( GET_STATUS_UMA_HISTOGRAM, status, Status.NUM_ENTRIES); diff --git a/base/containers/enum_set.h b/base/containers/enum_set.h index 204f7f072a1449..30fbb3662d0e98 100644 --- a/base/containers/enum_set.h +++ b/base/containers/enum_set.h @@ -48,6 +48,10 @@ class EnumSet { "First template parameter of EnumSet must be an enumeration type"); using enum_underlying_type = std::underlying_type_t; + static constexpr bool InRange(E value) { + return (value >= MinEnumValue) && (value <= MaxEnumValue); + } + static constexpr enum_underlying_type GetUnderlyingValue(E value) { return static_cast(value); } @@ -95,7 +99,7 @@ class EnumSet { class Iterator { public: Iterator() : enums_(nullptr), i_(kValueCount) {} - ~Iterator() {} + ~Iterator() = default; bool operator==(const Iterator& other) const { return i_ == other.i_; } @@ -147,12 +151,15 @@ class EnumSet { size_t i_; }; - EnumSet() {} + EnumSet() = default; ~EnumSet() = default; static constexpr uint64_t single_val_bitstring(E val) { - return 1ULL << (ToIndex(val)); + const uint64_t bitstring = 1; + const size_t shift_amount = ToIndex(val); + CHECK_LT(shift_amount, sizeof(bitstring) * 8); + return bitstring << shift_amount; } template @@ -175,6 +182,7 @@ class EnumSet { // Returns an EnumSet with all the values from start to end, inclusive. static constexpr EnumSet FromRange(E start, E end) { + CHECK_LE(start, end); return EnumSet(EnumBitSet( ((single_val_bitstring(end)) - (single_val_bitstring(start))) | (single_val_bitstring(end)))); @@ -218,8 +226,8 @@ class EnumSet { // Adds all values in the given range to our set, inclusive. void PutRange(E start, E end) { + CHECK_LE(start, end); size_t endIndexInclusive = ToIndex(end); - DCHECK_LE(ToIndex(start), endIndexInclusive); for (size_t current = ToIndex(start); current <= endIndexInclusive; ++current) { enums_.set(current); @@ -291,14 +299,11 @@ class EnumSet { "Max number of enum values is 64 for constexpr "); } - static constexpr bool InRange(E value) { - return (value >= MinEnumValue) && (value <= MaxEnumValue); - } - // Converts a value to/from an index into |enums_|. - static constexpr size_t ToIndex(E value) { - return GetUnderlyingValue(value) - GetUnderlyingValue(MinEnumValue); + CHECK(InRange(value)); + return static_cast(GetUnderlyingValue(value)) - + static_cast(GetUnderlyingValue(MinEnumValue)); } static E FromIndex(size_t i) { diff --git a/base/containers/enum_set_unittest.cc b/base/containers/enum_set_unittest.cc index f025c8a371f90e..4ecbe7d08adff7 100644 --- a/base/containers/enum_set_unittest.cc +++ b/base/containers/enum_set_unittest.cc @@ -6,12 +6,16 @@ #include +#include "base/test/gtest_util.h" +#include "testing/gtest/include/gtest/gtest-death-test.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { namespace { enum class TestEnum { + TEST_BELOW_MIN_NEGATIVE = -1, + TEST_BELOW_MIN = 0, TEST_1 = 1, TEST_MIN = TEST_1, TEST_2, @@ -19,7 +23,8 @@ enum class TestEnum { TEST_4, TEST_5, TEST_MAX = TEST_5, - TEST_6_OUT_OF_BOUNDS + TEST_6_OUT_OF_BOUNDS, + TEST_7_OUT_OF_BOUNDS }; using TestEnumSet = EnumSet; @@ -35,9 +40,9 @@ using TestEnumExtremeSet = EnumSet; class EnumSetTest : public ::testing::Test {}; +class EnumSetDeathTest : public ::testing::Test {}; TEST_F(EnumSetTest, ClassConstants) { - TestEnumSet enums; EXPECT_EQ(TestEnum::TEST_MIN, TestEnumSet::kMinValue); EXPECT_EQ(TestEnum::TEST_MAX, TestEnumSet::kMaxValue); EXPECT_EQ(static_cast(5), TestEnumSet::kValueCount); @@ -47,16 +52,21 @@ TEST_F(EnumSetTest, ClassConstants) { // evaluatable are really that way. TEST_F(EnumSetTest, ConstexprsAreValid) { static_assert(TestEnumSet::All().Has(TestEnum::TEST_2), - "expected All() to be integral constant expression"); + "Expected All() to be integral constant expression"); static_assert(TestEnumSet::FromRange(TestEnum::TEST_2, TestEnum::TEST_4) .Has(TestEnum::TEST_2), - "expected FromRange() to be integral constant expression"); + "Expected FromRange() to be integral constant expression"); static_assert(TestEnumSet(TestEnum::TEST_2).Has(TestEnum::TEST_2), - "expected TestEnumSet() to be integral constant expression"); + "Expected TestEnumSet() to be integral constant expression"); static_assert( TestEnumSet::FromEnumBitmask(1 << static_cast(TestEnum::TEST_2)) .Has(TestEnum::TEST_2), "Expected TestEnumSet() to be integral constant expression"); + static_assert( + TestEnumSet::single_val_bitstring(TestEnum::TEST_1) == 1, + "Expected single_val_bitstring() to be integral constant expression"); + static_assert(TestEnumSet::bitstring(TestEnum::TEST_1, TestEnum::TEST_2) == 3, + "Expected bitstring() to be integral constant expression"); } TEST_F(EnumSetTest, DefaultConstructor) { @@ -232,8 +242,7 @@ TEST_F(EnumSetTest, Iterators) { } TEST_F(EnumSetTest, RangeBasedForLoop) { - const TestEnumSet enums1(TestEnum::TEST_2, TestEnum::TEST_5, - TestEnum::TEST_6_OUT_OF_BOUNDS); + const TestEnumSet enums1(TestEnum::TEST_2, TestEnum::TEST_5); TestEnumSet enums2; for (TestEnum e : enums1) { enums2.Put(e); @@ -242,8 +251,7 @@ TEST_F(EnumSetTest, RangeBasedForLoop) { } TEST_F(EnumSetTest, IteratorComparisonOperators) { - const TestEnumSet enums(TestEnum::TEST_2, TestEnum::TEST_4, - TestEnum::TEST_6_OUT_OF_BOUNDS); + const TestEnumSet enums(TestEnum::TEST_2, TestEnum::TEST_4); const auto first_it = enums.begin(); const auto second_it = ++enums.begin(); @@ -264,8 +272,7 @@ TEST_F(EnumSetTest, IteratorComparisonOperators) { } TEST_F(EnumSetTest, IteratorIncrementOperators) { - const TestEnumSet enums(TestEnum::TEST_2, TestEnum::TEST_4, - TestEnum::TEST_6_OUT_OF_BOUNDS); + const TestEnumSet enums(TestEnum::TEST_2, TestEnum::TEST_4); const auto begin = enums.begin(); auto post_inc_it = begin; @@ -348,5 +355,181 @@ TEST_F(EnumSetTest, ToFromEnumBitmaskExtreme) { EXPECT_EQ(TestEnumExtremeSet::FromEnumBitmask(val1), enums1); } +TEST_F(EnumSetTest, FromEnumBitmaskIgnoresExtraBits) { + const TestEnumSet kSets[] = { + TestEnumSet(), + TestEnumSet(TestEnum::TEST_MIN), + TestEnumSet(TestEnum::TEST_MAX), + TestEnumSet(TestEnum::TEST_MIN, TestEnum::TEST_MAX), + TestEnumSet(TestEnum::TEST_MIN, TestEnum::TEST_MAX), + TestEnumSet(TestEnum::TEST_2, TestEnum::TEST_4), + }; + size_t i = 0; + for (const TestEnumSet& set : kSets) { + SCOPED_TRACE(i++); + const uint64_t val = set.ToEnumBitmask(); + + // Produce a bitstring for a single enum value. When `e` is in range + // relative to TestEnumSet, this function behaves identically to + // `single_val_bitstring`. When `e` is not in range, this function attempts + // to compute a value, while `single_val_bitstring` intentionally crashes. + auto single_val_bitstring = [](TestEnum e) -> uint64_t { + uint64_t shift_amount = static_cast(e); + // Shifting left more than the number of bits in the lhs would be UB. + CHECK_LT(shift_amount, sizeof(uint64_t) * 8); + return 1ULL << shift_amount; + }; + + const uint64_t kJunkVals[] = { + // Add junk bits above TEST_MAX. + val | single_val_bitstring(TestEnum::TEST_6_OUT_OF_BOUNDS), + val | single_val_bitstring(TestEnum::TEST_7_OUT_OF_BOUNDS), + val | single_val_bitstring(TestEnum::TEST_6_OUT_OF_BOUNDS) | + single_val_bitstring(TestEnum::TEST_7_OUT_OF_BOUNDS), + // Add junk bits below TEST_MIN. + val | single_val_bitstring(TestEnum::TEST_BELOW_MIN), + }; + for (uint64_t junk_val : kJunkVals) { + SCOPED_TRACE(junk_val); + ASSERT_NE(val, junk_val); + + const TestEnumSet set_from_junk = TestEnumSet::FromEnumBitmask(junk_val); + EXPECT_EQ(set_from_junk, set); + EXPECT_EQ(set_from_junk.ToEnumBitmask(), set.ToEnumBitmask()); + + // Iterating both sets should produce the same sequence. + auto it1 = set.begin(); + auto it2 = set_from_junk.begin(); + while (it1 != set.end() && it2 != set_from_junk.end()) { + EXPECT_EQ(*it1, *it2); + ++it1; + ++it2; + } + EXPECT_TRUE(it1 == set.end()); + EXPECT_TRUE(it2 == set_from_junk.end()); + } + } +} + +TEST_F(EnumSetDeathTest, SingleValBitstringCrashesOnOutOfRange) { + EXPECT_CHECK_DEATH( + TestEnumSet::single_val_bitstring(TestEnum::TEST_BELOW_MIN)); + EXPECT_CHECK_DEATH( + TestEnumSet::single_val_bitstring(TestEnum::TEST_6_OUT_OF_BOUNDS)); + EXPECT_CHECK_DEATH( + TestEnumSet::single_val_bitstring(TestEnum::TEST_7_OUT_OF_BOUNDS)); +} + +TEST_F(EnumSetDeathTest, SingleValBitstringEnumWithNegatives) { + enum class TestEnumNeg { + TEST_BELOW_MIN = -3, + TEST_A = -2, + TEST_MIN = TEST_A, + TEST_B = -1, + TEST_C = 0, + TEST_D = 1, + TEST_E = 2, + TEST_MAX = TEST_E, + TEST_F = 3, + }; + // This EnumSet starts negative and ends positive. + using TestEnumWithNegSet = + EnumSet; + + // Should crash because TEST_BELOW_MIN is not in range. + EXPECT_CHECK_DEATH( + TestEnumWithNegSet::single_val_bitstring(TestEnumNeg::TEST_BELOW_MIN)); + // TEST_D is in range, but note that TEST_MIN is negative. This should work. + EXPECT_EQ(TestEnumWithNegSet::single_val_bitstring(TestEnumNeg::TEST_D), + 1u << 3); + // Even though TEST_A is negative, it is in range, so this should work. + EXPECT_EQ(TestEnumWithNegSet::single_val_bitstring(TestEnumNeg::TEST_A), + 1u << 0); +} + +TEST_F(EnumSetDeathTest, SingleValBitstringEnumWithOnlyNegatives) { + enum class TestEnumNeg { + TEST_BELOW_MIN = -10, + TEST_A = -9, + TEST_MIN = TEST_A, + TEST_B = -8, + TEST_C = -7, + TEST_D = -6, + TEST_MAX = TEST_D, + TEST_F = -5, + }; + // This EnumSet starts negative and ends negative. + using TestEnumWithNegSet = + EnumSet; + + // Should crash because TEST_BELOW_MIN is not in range. + EXPECT_CHECK_DEATH( + TestEnumWithNegSet::single_val_bitstring(TestEnumNeg::TEST_BELOW_MIN)); + // TEST_D is in range, but note that TEST_MIN is negative. This should work. + EXPECT_EQ(TestEnumWithNegSet::single_val_bitstring(TestEnumNeg::TEST_D), + 1u << 3); + // Even though TEST_A is negative, it is in range, so this should work. + EXPECT_EQ(TestEnumWithNegSet::single_val_bitstring(TestEnumNeg::TEST_A), + 1u << 0); +} + +TEST_F(EnumSetDeathTest, VariadicConstructorCrashesOnOutOfRange) { + // Constructor should crash given out-of-range values. + EXPECT_CHECK_DEATH(TestEnumSet(TestEnum::TEST_BELOW_MIN).Empty()); + EXPECT_CHECK_DEATH(TestEnumSet(TestEnum::TEST_BELOW_MIN_NEGATIVE).Empty()); + EXPECT_CHECK_DEATH(TestEnumSet(TestEnum::TEST_6_OUT_OF_BOUNDS).Empty()); +} + +TEST_F(EnumSetDeathTest, FromRangeCrashesOnBadInputs) { + // FromRange crashes when the bounds are in range, but out of order. + EXPECT_CHECK_DEATH( + TestEnumSet().FromRange(TestEnum::TEST_3, TestEnum::TEST_1)); + + // FromRange crashes when the start value is out of range. + EXPECT_CHECK_DEATH( + TestEnumSet().FromRange(TestEnum::TEST_BELOW_MIN, TestEnum::TEST_1)); + EXPECT_CHECK_DEATH(TestEnumSet().FromRange(TestEnum::TEST_BELOW_MIN_NEGATIVE, + TestEnum::TEST_1)); + EXPECT_CHECK_DEATH(TestEnumSet().FromRange(TestEnum::TEST_6_OUT_OF_BOUNDS, + TestEnum::TEST_1)); + + // FromRange crashes when the end value is out of range. + EXPECT_CHECK_DEATH( + TestEnumSet().FromRange(TestEnum::TEST_3, TestEnum::TEST_BELOW_MIN)); + EXPECT_CHECK_DEATH(TestEnumSet().FromRange( + TestEnum::TEST_3, TestEnum::TEST_BELOW_MIN_NEGATIVE)); + EXPECT_CHECK_DEATH(TestEnumSet().FromRange(TestEnum::TEST_3, + TestEnum::TEST_6_OUT_OF_BOUNDS)); + + // Crashes when start and end are both out of range. + EXPECT_CHECK_DEATH(TestEnumSet().FromRange(TestEnum::TEST_7_OUT_OF_BOUNDS, + TestEnum::TEST_6_OUT_OF_BOUNDS)); + EXPECT_CHECK_DEATH(TestEnumSet().FromRange(TestEnum::TEST_6_OUT_OF_BOUNDS, + TestEnum::TEST_7_OUT_OF_BOUNDS)); +} + +TEST_F(EnumSetDeathTest, PutCrashesOnOutOfRange) { + EXPECT_CHECK_DEATH(TestEnumSet().Put(TestEnum::TEST_BELOW_MIN)); + EXPECT_CHECK_DEATH(TestEnumSet().Put(TestEnum::TEST_BELOW_MIN_NEGATIVE)); + EXPECT_CHECK_DEATH(TestEnumSet().Put(TestEnum::TEST_6_OUT_OF_BOUNDS)); + EXPECT_CHECK_DEATH(TestEnumSet().Put(TestEnum::TEST_7_OUT_OF_BOUNDS)); +} + +TEST_F(EnumSetDeathTest, PutRangeCrashesOnBadInputs) { + // Crashes when one input is out of range. + EXPECT_CHECK_DEATH(TestEnumSet().PutRange(TestEnum::TEST_BELOW_MIN_NEGATIVE, + TestEnum::TEST_BELOW_MIN)); + EXPECT_CHECK_DEATH( + TestEnumSet().PutRange(TestEnum::TEST_3, TestEnum::TEST_7_OUT_OF_BOUNDS)); + + // Crashes when both inputs are out of range. + EXPECT_CHECK_DEATH(TestEnumSet().PutRange(TestEnum::TEST_6_OUT_OF_BOUNDS, + TestEnum::TEST_7_OUT_OF_BOUNDS)); + + // Crashes when inputs are out of order. + EXPECT_CHECK_DEATH( + TestEnumSet().PutRange(TestEnum::TEST_2, TestEnum::TEST_1)); +} + } // namespace } // namespace base diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 7ab9e4879c1f15..8f856653e1e1c4 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1 @@ -1 +1 @@ -7.20211215.1.1 +7.20211215.2.1 diff --git a/buildtools/third_party/libunwind/BUILD.gn b/buildtools/third_party/libunwind/BUILD.gn index 7560674b5bfe62..36f1d9b921e4c7 100644 --- a/buildtools/third_party/libunwind/BUILD.gn +++ b/buildtools/third_party/libunwind/BUILD.gn @@ -5,6 +5,7 @@ import("//build/config/c++/c++.gni") config("libunwind_config") { + defines = [ "_LIBUNWIND_IS_NATIVE_ONLY" ] cflags = [ "-fstrict-aliasing", "-fPIC", diff --git a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/MessageCardViewBinderTest.java b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/MessageCardViewBinderTest.java index 70027f6d7e7c3d..89fadd5111a7f8 100644 --- a/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/MessageCardViewBinderTest.java +++ b/chrome/android/features/tab_ui/javatests/src/org/chromium/chrome/browser/tasks/tab_management/MessageCardViewBinderTest.java @@ -24,6 +24,7 @@ import org.chromium.base.test.UiThreadTest; import org.chromium.chrome.tab_ui.R; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.components.browser_ui.styles.SemanticColorUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.modelutil.PropertyModelChangeProcessor; @@ -180,8 +181,7 @@ public void testUpdateMessageCardColor() { mItemView.getContext(), R.color.default_text_color_list) .getDefaultColor())); assertThat(actionButton.getCurrentTextColor(), - equalTo(ApiCompatibilityUtils.getColor( - mItemView.getResources(), R.color.default_text_color_link))); + equalTo(SemanticColorUtils.getDefaultTextColorLink(mItemView.getContext()))); assertThat(closeButton.getImageTintList(), equalTo(AppCompatResources.getColorStateList( getActivity(), R.color.default_icon_color_tint_list))); diff --git a/chrome/android/java/res/values/styles.xml b/chrome/android/java/res/values/styles.xml index 48045abbdf5da6..e5e65088243db2 100644 --- a/chrome/android/java/res/values/styles.xml +++ b/chrome/android/java/res/values/styles.xml @@ -122,7 +122,7 @@ parent="Theme.BrowserUI.DialogWhenLarge"> @drawable/bg_white_dialog @style/TextAppearance.TextMedium.Primary - @color/default_text_color_link + @macro/default_text_color_link @android:color/black @macro/default_control_color_active @color/control_highlight_color @@ -345,7 +345,7 @@ + +