Commit 78d13cb4 authored by David Tseng's avatar David Tseng Committed by Chromium LUCI CQ

Fix VK enabling path for Switch Access

Previously, Switch Access may have not enabled the virtual keyboard when
transitioning between profiles, while still remaining enabled.

R=dmazzoni@chromium.org
Fixed: 1151515

Change-Id: I192c4694747445e408f7fec6aaa600f728dad4d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2590370
Commit-Queue: David Tseng <dtseng@chromium.org>
Auto-Submit: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836850}
parent 6b213285
......@@ -29,6 +29,8 @@ class AccessibilityExtensionLoader {
bool loaded() { return loaded_; }
Profile* profile() { return profile_; }
private:
void LoadExtension(Profile* profile, base::Closure done_cb);
void LoadExtensionImpl(Profile* profile, base::Closure done_cb);
......
......@@ -950,9 +950,22 @@ void AccessibilityManager::OnSwitchAccessChanged() {
const bool enabled = profile_->GetPrefs()->GetBoolean(
ash::prefs::kAccessibilitySwitchAccessEnabled);
if (enabled)
if (enabled) {
// Only update |was_vk_enabled_before_switch_access_| if the profile
// changed.
if (profile_ != switch_access_loader_->profile()) {
was_vk_enabled_before_switch_access_ =
ChromeKeyboardControllerClient::Get()->IsEnableFlagSet(
keyboard::KeyboardEnableFlag::kExtensionEnabled);
}
switch_access_loader_->SetProfile(profile_, base::Closure());
// Make sure we always update the VK state, on every profile transition.
ChromeKeyboardControllerClient::Get()->SetEnableFlag(
keyboard::KeyboardEnableFlag::kExtensionEnabled);
}
if (switch_access_enabled_ == enabled)
return;
switch_access_enabled_ = enabled;
......@@ -1481,12 +1494,6 @@ void AccessibilityManager::PostUnloadSelectToSpeak() {
void AccessibilityManager::PostLoadSwitchAccess() {
InitializeFocusRings(extension_misc::kSwitchAccessExtensionId);
was_vk_enabled_before_switch_access_ =
ChromeKeyboardControllerClient::Get()->IsEnableFlagSet(
keyboard::KeyboardEnableFlag::kExtensionEnabled);
ChromeKeyboardControllerClient::Get()->SetEnableFlag(
keyboard::KeyboardEnableFlag::kExtensionEnabled);
}
void AccessibilityManager::PostUnloadSwitchAccess() {
......
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