diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index adf15ef8a343..664de71d5d6a 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -709,6 +709,7 @@ void HandleToggleVoiceInteraction(const ui::Accelerator& accelerator) { case mojom::AssistantAllowedState::DISALLOWED_BY_ARC_DISALLOWED: case mojom::AssistantAllowedState::DISALLOWED_BY_FLAG: case mojom::AssistantAllowedState::DISALLOWED_BY_SUPERVISED_USER: + case mojom::AssistantAllowedState::DISALLOWED_BY_CHILD_USER: case mojom::AssistantAllowedState::DISALLOWED_BY_INCOGNITO: // TODO(xiaohuic): show a specific toast. return; diff --git a/ash/public/interfaces/voice_interaction_controller.mojom b/ash/public/interfaces/voice_interaction_controller.mojom index 04589e3adf6f..ccada86fdf2e 100644 --- a/ash/public/interfaces/voice_interaction_controller.mojom +++ b/ash/public/interfaces/voice_interaction_controller.mojom @@ -39,6 +39,8 @@ enum AssistantAllowedState { DISALLOWED_BY_NONPRIMARY_USER, // Disallowed because current user is supervised user. DISALLOWED_BY_SUPERVISED_USER, + // Disallowed because current user is child user. + DISALLOWED_BY_CHILD_USER, // Disallowed because incognito mode. DISALLOWED_BY_INCOGNITO, // Disallowed because the device is in demo mode. diff --git a/chrome/browser/chromeos/arc/arc_util.cc b/chrome/browser/chromeos/arc/arc_util.cc index 386f33006e3b..21284a6e9e5a 100644 --- a/chrome/browser/chromeos/arc/arc_util.cc +++ b/chrome/browser/chromeos/arc/arc_util.cc @@ -597,6 +597,9 @@ ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile( if (profile->IsLegacySupervised()) return ash::mojom::AssistantAllowedState::DISALLOWED_BY_SUPERVISED_USER; + if (profile->IsChild()) + return ash::mojom::AssistantAllowedState::DISALLOWED_BY_CHILD_USER; + if (chromeos::DemoSession::IsDeviceInDemoMode()) return ash::mojom::AssistantAllowedState::DISALLOWED_BY_DEMO_MODE; diff --git a/chrome/browser/chromeos/arc/arc_util_unittest.cc b/chrome/browser/chromeos/arc/arc_util_unittest.cc index 426c5ad73093..c3d89dfd5aff 100644 --- a/chrome/browser/chromeos/arc/arc_util_unittest.cc +++ b/chrome/browser/chromeos/arc/arc_util_unittest.cc @@ -29,6 +29,7 @@ #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/policy/profile_policy_connector_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/supervised_user/supervised_user_constants.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" @@ -531,6 +532,18 @@ TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_SupervisedUser) { IsAssistantAllowedForProfile(profile())); } +TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_ChildUser) { + base::CommandLine::ForCurrentProcess()->InitFromArgv( + {"", "--arc-availability=officially-supported", + "--enable-voice-interaction"}); + ScopedLogIn login(GetFakeUserManager(), + AccountId::FromUserEmailGaiaId( + profile()->GetProfileUserName(), kTestGaiaId)); + profile()->SetSupervisedUserId(supervised_users::kChildAccountSUID); + EXPECT_EQ(ash::mojom::AssistantAllowedState::DISALLOWED_BY_CHILD_USER, + IsAssistantAllowedForProfile(profile())); +} + TEST_F(ChromeArcUtilTest, IsAssistantAllowedForProfile_Locale) { profile()->GetTestingPrefService()->SetString( language::prefs::kApplicationLocale, "he");