Commit aaccda65 authored by Qiang Xu's avatar Qiang Xu Committed by Commit Bot

croissant: show metalayer mode in palette tool

changes:
- Show `Assistant`, metalayer mode option in palette tool
- Currently `Assistant` option is still disabled.
- This CL doesn't trigger assistant mini bubble yet.

Bug: b/78193960
Test: test on device with enabled flag
Change-Id: I18196e03a7b4906f76daa6dc21adcbee6e3ee1d7
Reviewed-on: https://chromium-review.googlesource.com/1030855Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Qiang Xu <warx@google.com>
Cr-Commit-Position: refs/heads/master@{#556250}
parent c46ccbb0
...@@ -24,8 +24,10 @@ void PaletteTool::RegisterToolInstances(PaletteToolManager* tool_manager) { ...@@ -24,8 +24,10 @@ void PaletteTool::RegisterToolInstances(PaletteToolManager* tool_manager) {
tool_manager->AddTool(std::make_unique<CaptureRegionMode>(tool_manager)); tool_manager->AddTool(std::make_unique<CaptureRegionMode>(tool_manager));
tool_manager->AddTool(std::make_unique<CaptureScreenAction>(tool_manager)); tool_manager->AddTool(std::make_unique<CaptureScreenAction>(tool_manager));
tool_manager->AddTool(std::make_unique<CreateNoteAction>(tool_manager)); tool_manager->AddTool(std::make_unique<CreateNoteAction>(tool_manager));
if (chromeos::switches::IsVoiceInteractionEnabled()) if (chromeos::switches::IsVoiceInteractionEnabled() ||
chromeos::switches::IsAssistantEnabled()) {
tool_manager->AddTool(std::make_unique<MetalayerMode>(tool_manager)); tool_manager->AddTool(std::make_unique<MetalayerMode>(tool_manager));
}
tool_manager->AddTool(std::make_unique<LaserPointerMode>(tool_manager)); tool_manager->AddTool(std::make_unique<LaserPointerMode>(tool_manager));
tool_manager->AddTool(std::make_unique<MagnifierMode>(tool_manager)); tool_manager->AddTool(std::make_unique<MagnifierMode>(tool_manager));
} }
......
...@@ -563,11 +563,10 @@ void UpdateArcFileSystemCompatibilityPrefIfNeeded( ...@@ -563,11 +563,10 @@ void UpdateArcFileSystemCompatibilityPrefIfNeeded(
ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile( ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile(
const Profile* profile) { const Profile* profile) {
if (!chromeos::switches::IsVoiceInteractionFlagsEnabled()) if (!chromeos::switches::IsAssistantEnabled() &&
!chromeos::switches::IsVoiceInteractionFlagsEnabled()) {
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_FLAG; return ash::mojom::AssistantAllowedState::DISALLOWED_BY_FLAG;
}
if (!chromeos::switches::IsVoiceInteractionLocalesSupported())
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_LOCALE;
if (!chromeos::ProfileHelper::IsPrimaryProfile(profile)) if (!chromeos::ProfileHelper::IsPrimaryProfile(profile))
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_NONPRIMARY_USER; return ash::mojom::AssistantAllowedState::DISALLOWED_BY_NONPRIMARY_USER;
...@@ -578,14 +577,19 @@ ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile( ...@@ -578,14 +577,19 @@ ash::mojom::AssistantAllowedState IsAssistantAllowedForProfile(
if (profile->IsLegacySupervised()) if (profile->IsLegacySupervised())
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_SUPERVISED_USER; return ash::mojom::AssistantAllowedState::DISALLOWED_BY_SUPERVISED_USER;
const PrefService* prefs = profile->GetPrefs(); if (chromeos::switches::IsVoiceInteractionFlagsEnabled()) {
if (prefs->IsManagedPreference(prefs::kArcEnabled) && if (!chromeos::switches::IsVoiceInteractionLocalesSupported())
!prefs->GetBoolean(prefs::kArcEnabled)) { return ash::mojom::AssistantAllowedState::DISALLOWED_BY_LOCALE;
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_ARC_POLICY;
}
if (!IsArcAllowedForProfile(profile)) const PrefService* prefs = profile->GetPrefs();
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_ARC_DISALLOWED; if (prefs->IsManagedPreference(prefs::kArcEnabled) &&
!prefs->GetBoolean(prefs::kArcEnabled)) {
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_ARC_POLICY;
}
if (!IsArcAllowedForProfile(profile))
return ash::mojom::AssistantAllowedState::DISALLOWED_BY_ARC_DISALLOWED;
}
return ash::mojom::AssistantAllowedState::ALLOWED; return ash::mojom::AssistantAllowedState::ALLOWED;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment