Commit a734f0d6 authored by Zach Helfinstein's avatar Zach Helfinstein Committed by Commit Bot

Configure settings for dictation under manageAccessibility


Add dictation setting to settings/manageAccessibility

Bug: 801398
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I8e0c1b0508801ee9b7b7f0e3c6ac616dcdfa3e88
Reviewed-on: https://chromium-review.googlesource.com/1043085
Commit-Queue: Zach Helfinstein <zhelfins@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557253}
parent 189d1033
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "ash/system/power/backlights_forced_off_setter.h" #include "ash/system/power/backlights_forced_off_setter.h"
#include "ash/system/power/scoped_backlights_forced_off.h" #include "ash/system/power/scoped_backlights_forced_off.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "base/command_line.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chromeos/audio/cras_audio_handler.h" #include "chromeos/audio/cras_audio_handler.h"
#include "components/pref_registry/pref_registry_syncable.h" #include "components/pref_registry/pref_registry_syncable.h"
...@@ -58,6 +59,7 @@ constexpr const char* const kCopiedOnSigninAccessibilityPrefs[]{ ...@@ -58,6 +59,7 @@ constexpr const char* const kCopiedOnSigninAccessibilityPrefs[]{
prefs::kAccessibilityAutoclickEnabled, prefs::kAccessibilityAutoclickEnabled,
prefs::kAccessibilityCaretHighlightEnabled, prefs::kAccessibilityCaretHighlightEnabled,
prefs::kAccessibilityCursorHighlightEnabled, prefs::kAccessibilityCursorHighlightEnabled,
prefs::kAccessibilityDictationEnabled,
prefs::kAccessibilityFocusHighlightEnabled, prefs::kAccessibilityFocusHighlightEnabled,
prefs::kAccessibilityHighContrastEnabled, prefs::kAccessibilityHighContrastEnabled,
prefs::kAccessibilityLargeCursorEnabled, prefs::kAccessibilityLargeCursorEnabled,
...@@ -232,6 +234,7 @@ void AccessibilityController::RegisterProfilePrefs(PrefRegistrySimple* registry, ...@@ -232,6 +234,7 @@ void AccessibilityController::RegisterProfilePrefs(PrefRegistrySimple* registry,
false); false);
registry->RegisterBooleanPref(prefs::kAccessibilityCursorHighlightEnabled, registry->RegisterBooleanPref(prefs::kAccessibilityCursorHighlightEnabled,
false); false);
registry->RegisterBooleanPref(prefs::kAccessibilityDictationEnabled, false);
registry->RegisterBooleanPref(prefs::kAccessibilityFocusHighlightEnabled, registry->RegisterBooleanPref(prefs::kAccessibilityFocusHighlightEnabled,
false); false);
registry->RegisterBooleanPref(prefs::kAccessibilityHighContrastEnabled, registry->RegisterBooleanPref(prefs::kAccessibilityHighContrastEnabled,
...@@ -262,6 +265,7 @@ void AccessibilityController::RegisterProfilePrefs(PrefRegistrySimple* registry, ...@@ -262,6 +265,7 @@ void AccessibilityController::RegisterProfilePrefs(PrefRegistrySimple* registry,
registry->RegisterForeignPref(prefs::kAccessibilityAutoclickDelayMs); registry->RegisterForeignPref(prefs::kAccessibilityAutoclickDelayMs);
registry->RegisterForeignPref(prefs::kAccessibilityCaretHighlightEnabled); registry->RegisterForeignPref(prefs::kAccessibilityCaretHighlightEnabled);
registry->RegisterForeignPref(prefs::kAccessibilityCursorHighlightEnabled); registry->RegisterForeignPref(prefs::kAccessibilityCursorHighlightEnabled);
registry->RegisterForeignPref(prefs::kAccessibilityDictationEnabled);
registry->RegisterForeignPref(prefs::kAccessibilityFocusHighlightEnabled); registry->RegisterForeignPref(prefs::kAccessibilityFocusHighlightEnabled);
registry->RegisterForeignPref(prefs::kAccessibilityHighContrastEnabled); registry->RegisterForeignPref(prefs::kAccessibilityHighContrastEnabled);
registry->RegisterForeignPref(prefs::kAccessibilityLargeCursorEnabled); registry->RegisterForeignPref(prefs::kAccessibilityLargeCursorEnabled);
...@@ -324,6 +328,23 @@ bool AccessibilityController::IsCursorHighlightEnabled() const { ...@@ -324,6 +328,23 @@ bool AccessibilityController::IsCursorHighlightEnabled() const {
return cursor_highlight_enabled_; return cursor_highlight_enabled_;
} }
void AccessibilityController::SetDictationEnabled(bool enabled) {
if (!active_user_prefs_)
return;
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kEnableExperimentalAccessibilityFeatures)) {
return;
}
active_user_prefs_->SetBoolean(prefs::kAccessibilityDictationEnabled,
enabled);
active_user_prefs_->CommitPendingWrite();
}
bool AccessibilityController::IsDictationEnabled() const {
return dictation_enabled_;
}
void AccessibilityController::SetFocusHighlightEnabled(bool enabled) { void AccessibilityController::SetFocusHighlightEnabled(bool enabled) {
if (!active_user_prefs_) if (!active_user_prefs_)
return; return;
...@@ -474,6 +495,10 @@ void AccessibilityController::HandleAccessibilityGesture( ...@@ -474,6 +495,10 @@ void AccessibilityController::HandleAccessibilityGesture(
} }
void AccessibilityController::ToggleDictation() { void AccessibilityController::ToggleDictation() {
// Do nothing if dictation is not enabled.
if (!IsDictationEnabled())
return;
if (client_) { if (client_) {
client_->ToggleDictation(base::BindOnce( client_->ToggleDictation(base::BindOnce(
[](AccessibilityController* self, bool is_active) { [](AccessibilityController* self, bool is_active) {
...@@ -612,6 +637,10 @@ void AccessibilityController::ObservePrefs(PrefService* prefs) { ...@@ -612,6 +637,10 @@ void AccessibilityController::ObservePrefs(PrefService* prefs) {
base::BindRepeating( base::BindRepeating(
&AccessibilityController::UpdateCursorHighlightFromPref, &AccessibilityController::UpdateCursorHighlightFromPref,
base::Unretained(this))); base::Unretained(this)));
pref_change_registrar_->Add(
prefs::kAccessibilityDictationEnabled,
base::BindRepeating(&AccessibilityController::UpdateDictationFromPref,
base::Unretained(this)));
pref_change_registrar_->Add( pref_change_registrar_->Add(
prefs::kAccessibilityFocusHighlightEnabled, prefs::kAccessibilityFocusHighlightEnabled,
base::BindRepeating( base::BindRepeating(
...@@ -740,6 +769,19 @@ void AccessibilityController::UpdateCursorHighlightFromPref() { ...@@ -740,6 +769,19 @@ void AccessibilityController::UpdateCursorHighlightFromPref() {
UpdateAccessibilityHighlightingFromPrefs(); UpdateAccessibilityHighlightingFromPrefs();
} }
void AccessibilityController::UpdateDictationFromPref() {
DCHECK(active_user_prefs_);
const bool enabled =
active_user_prefs_->GetBoolean(prefs::kAccessibilityDictationEnabled);
if (dictation_enabled_ == enabled)
return;
dictation_enabled_ = enabled;
NotifyAccessibilityStatusChanged();
}
void AccessibilityController::UpdateFocusHighlightFromPref() { void AccessibilityController::UpdateFocusHighlightFromPref() {
DCHECK(active_user_prefs_); DCHECK(active_user_prefs_);
bool enabled = active_user_prefs_->GetBoolean( bool enabled = active_user_prefs_->GetBoolean(
......
...@@ -64,6 +64,9 @@ class ASH_EXPORT AccessibilityController ...@@ -64,6 +64,9 @@ class ASH_EXPORT AccessibilityController
void SetCursorHighlightEnabled(bool enabled); void SetCursorHighlightEnabled(bool enabled);
bool IsCursorHighlightEnabled() const; bool IsCursorHighlightEnabled() const;
void SetDictationEnabled(bool enabled);
bool IsDictationEnabled() const;
void SetFocusHighlightEnabled(bool enabled); void SetFocusHighlightEnabled(bool enabled);
bool IsFocusHighlightEnabled() const; bool IsFocusHighlightEnabled() const;
...@@ -162,6 +165,7 @@ class ASH_EXPORT AccessibilityController ...@@ -162,6 +165,7 @@ class ASH_EXPORT AccessibilityController
void UpdateAutoclickDelayFromPref(); void UpdateAutoclickDelayFromPref();
void UpdateCaretHighlightFromPref(); void UpdateCaretHighlightFromPref();
void UpdateCursorHighlightFromPref(); void UpdateCursorHighlightFromPref();
void UpdateDictationFromPref();
void UpdateFocusHighlightFromPref(); void UpdateFocusHighlightFromPref();
void UpdateHighContrastFromPref(); void UpdateHighContrastFromPref();
void UpdateLargeCursorFromPref(); void UpdateLargeCursorFromPref();
...@@ -190,6 +194,7 @@ class ASH_EXPORT AccessibilityController ...@@ -190,6 +194,7 @@ class ASH_EXPORT AccessibilityController
base::TimeDelta autoclick_delay_; base::TimeDelta autoclick_delay_;
bool caret_highlight_enabled_ = false; bool caret_highlight_enabled_ = false;
bool cursor_highlight_enabled_ = false; bool cursor_highlight_enabled_ = false;
bool dictation_enabled_ = false;
bool focus_highlight_enabled_ = false; bool focus_highlight_enabled_ = false;
bool high_contrast_enabled_ = false; bool high_contrast_enabled_ = false;
bool large_cursor_enabled_ = false; bool large_cursor_enabled_ = false;
......
...@@ -81,6 +81,7 @@ TEST_F(AccessibilityControllerTest, PrefsAreRegistered) { ...@@ -81,6 +81,7 @@ TEST_F(AccessibilityControllerTest, PrefsAreRegistered) {
prefs->FindPreference(prefs::kAccessibilityCaretHighlightEnabled)); prefs->FindPreference(prefs::kAccessibilityCaretHighlightEnabled));
EXPECT_TRUE( EXPECT_TRUE(
prefs->FindPreference(prefs::kAccessibilityCursorHighlightEnabled)); prefs->FindPreference(prefs::kAccessibilityCursorHighlightEnabled));
EXPECT_TRUE(prefs->FindPreference(prefs::kAccessibilityDictationEnabled));
EXPECT_TRUE( EXPECT_TRUE(
prefs->FindPreference(prefs::kAccessibilityFocusHighlightEnabled)); prefs->FindPreference(prefs::kAccessibilityFocusHighlightEnabled));
EXPECT_TRUE(prefs->FindPreference(prefs::kAccessibilityHighContrastEnabled)); EXPECT_TRUE(prefs->FindPreference(prefs::kAccessibilityHighContrastEnabled));
......
...@@ -377,6 +377,9 @@ This file contains the strings for ash. ...@@ -377,6 +377,9 @@ This file contains the strings for ash.
<message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SELECT_TO_SPEAK" desc="The label used in the accessibility menu of the system tray to toggle on/off the select-to-speak feature."> <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SELECT_TO_SPEAK" desc="The label used in the accessibility menu of the system tray to toggle on/off the select-to-speak feature.">
Select-to-Speak Select-to-Speak
</message> </message>
<message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_DICTATION" desc="The label used in the accessibility menu of the system tray to toggle on/off the speak to type feature.">
Dictation
</message>
<message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE" desc="The label used in the accessibility menu of the system tray to toggle on/off high contrast feature."> <message name="IDS_ASH_STATUS_TRAY_ACCESSIBILITY_HIGH_CONTRAST_MODE" desc="The label used in the accessibility menu of the system tray to toggle on/off high contrast feature.">
High contrast mode High contrast mode
</message> </message>
......
...@@ -63,6 +63,8 @@ const char kAccessibilitySelectToSpeakEnabled[] = ...@@ -63,6 +63,8 @@ const char kAccessibilitySelectToSpeakEnabled[] =
"settings.a11y.select_to_speak"; "settings.a11y.select_to_speak";
// A boolean pref which determines whether switch access is enabled. // A boolean pref which determines whether switch access is enabled.
const char kAccessibilitySwitchAccessEnabled[] = "settings.a11y.switch_access"; const char kAccessibilitySwitchAccessEnabled[] = "settings.a11y.switch_access";
// A boolean pref which determines whether dictation is enabled.
const char kAccessibilityDictationEnabled[] = "settings.a11y.dictation";
// A boolean pref which determines whether the accessibility menu shows // A boolean pref which determines whether the accessibility menu shows
// regardless of the state of a11y features. // regardless of the state of a11y features.
const char kShouldAlwaysShowAccessibilityMenu[] = "settings.a11y.enable_menu"; const char kShouldAlwaysShowAccessibilityMenu[] = "settings.a11y.enable_menu";
......
...@@ -28,6 +28,7 @@ ASH_PUBLIC_EXPORT extern const char kAccessibilityCursorHighlightEnabled[]; ...@@ -28,6 +28,7 @@ ASH_PUBLIC_EXPORT extern const char kAccessibilityCursorHighlightEnabled[];
ASH_PUBLIC_EXPORT extern const char kAccessibilityFocusHighlightEnabled[]; ASH_PUBLIC_EXPORT extern const char kAccessibilityFocusHighlightEnabled[];
ASH_PUBLIC_EXPORT extern const char kAccessibilitySelectToSpeakEnabled[]; ASH_PUBLIC_EXPORT extern const char kAccessibilitySelectToSpeakEnabled[];
ASH_PUBLIC_EXPORT extern const char kAccessibilitySwitchAccessEnabled[]; ASH_PUBLIC_EXPORT extern const char kAccessibilitySwitchAccessEnabled[];
ASH_PUBLIC_EXPORT extern const char kAccessibilityDictationEnabled[];
ASH_PUBLIC_EXPORT extern const char kShouldAlwaysShowAccessibilityMenu[]; ASH_PUBLIC_EXPORT extern const char kShouldAlwaysShowAccessibilityMenu[];
ASH_PUBLIC_EXPORT extern const char kDockedMagnifierEnabled[]; ASH_PUBLIC_EXPORT extern const char kDockedMagnifierEnabled[];
......
...@@ -59,6 +59,7 @@ void DictationButtonTray::OnDictationEnded() { ...@@ -59,6 +59,7 @@ void DictationButtonTray::OnDictationEnded() {
} }
void DictationButtonTray::OnAccessibilityStatusChanged() { void DictationButtonTray::OnAccessibilityStatusChanged() {
UpdateVisibility();
CheckDictationStatusAndUpdateIcon(); CheckDictationStatusAndUpdateIcon();
} }
...@@ -82,9 +83,8 @@ void DictationButtonTray::UpdateIcon(bool dictation_active) { ...@@ -82,9 +83,8 @@ void DictationButtonTray::UpdateIcon(bool dictation_active) {
} }
void DictationButtonTray::UpdateVisibility() { void DictationButtonTray::UpdateVisibility() {
// TODO(zhelfins): Check dictation settings once they are configured. bool is_visible =
// https://crbug.com/801398 Shell::Get()->accessibility_controller()->IsDictationEnabled();
bool is_visible = true;
SetVisible(is_visible); SetVisible(is_visible);
} }
......
...@@ -81,12 +81,14 @@ class DictationButtonTrayTest : public AshTestBase { ...@@ -81,12 +81,14 @@ class DictationButtonTrayTest : public AshTestBase {
// Ensures that creation doesn't cause any crashes and adds the image icon. // Ensures that creation doesn't cause any crashes and adds the image icon.
// Also checks that the tray is visible. // Also checks that the tray is visible.
TEST_F(DictationButtonTrayTest, BasicConstruction) { TEST_F(DictationButtonTrayTest, BasicConstruction) {
Shell::Get()->accessibility_controller()->SetDictationEnabled(true);
EXPECT_TRUE(GetImageView(GetTray())); EXPECT_TRUE(GetImageView(GetTray()));
EXPECT_TRUE(GetTray()->visible()); EXPECT_TRUE(GetTray()->visible());
} }
// Test that clicking the button activates dictation. // Test that clicking the button activates dictation.
TEST_F(DictationButtonTrayTest, ButtonActivatesDictation) { TEST_F(DictationButtonTrayTest, ButtonActivatesDictation) {
Shell::Get()->accessibility_controller()->SetDictationEnabled(true);
AccessibilityController* controller = AccessibilityController* controller =
Shell::Get()->accessibility_controller(); Shell::Get()->accessibility_controller();
TestAccessibilityControllerClient client; TestAccessibilityControllerClient client;
...@@ -105,6 +107,7 @@ TEST_F(DictationButtonTrayTest, ButtonActivatesDictation) { ...@@ -105,6 +107,7 @@ TEST_F(DictationButtonTrayTest, ButtonActivatesDictation) {
// Test that activating dictation causes the button to activate. // Test that activating dictation causes the button to activate.
TEST_F(DictationButtonTrayTest, ActivatingDictationActivatesButton) { TEST_F(DictationButtonTrayTest, ActivatingDictationActivatesButton) {
Shell::Get()->accessibility_controller()->SetDictationEnabled(true);
Shell::Get()->OnDictationStarted(); Shell::Get()->OnDictationStarted();
EXPECT_TRUE(GetTray()->is_active()); EXPECT_TRUE(GetTray()->is_active());
...@@ -115,6 +118,7 @@ TEST_F(DictationButtonTrayTest, ActivatingDictationActivatesButton) { ...@@ -115,6 +118,7 @@ TEST_F(DictationButtonTrayTest, ActivatingDictationActivatesButton) {
// Tests that the tray only renders as active while dictation is listening. Any // Tests that the tray only renders as active while dictation is listening. Any
// termination of dictation clears the active state. // termination of dictation clears the active state.
TEST_F(DictationButtonTrayTest, ActiveStateOnlyDuringDictation) { TEST_F(DictationButtonTrayTest, ActiveStateOnlyDuringDictation) {
Shell::Get()->accessibility_controller()->SetDictationEnabled(true);
AccessibilityController* controller = AccessibilityController* controller =
Shell::Get()->accessibility_controller(); Shell::Get()->accessibility_controller();
TestAccessibilityControllerClient client; TestAccessibilityControllerClient client;
......
...@@ -52,6 +52,7 @@ enum AccessibilityState { ...@@ -52,6 +52,7 @@ enum AccessibilityState {
A11Y_STICKY_KEYS = 1 << 10, A11Y_STICKY_KEYS = 1 << 10,
A11Y_SELECT_TO_SPEAK = 1 << 11, A11Y_SELECT_TO_SPEAK = 1 << 11,
A11Y_DOCKED_MAGNIFIER = 1 << 12, A11Y_DOCKED_MAGNIFIER = 1 << 12,
A11Y_DICTATION = 1 << 13,
}; };
uint32_t GetAccessibilityState() { uint32_t GetAccessibilityState() {
...@@ -83,6 +84,8 @@ uint32_t GetAccessibilityState() { ...@@ -83,6 +84,8 @@ uint32_t GetAccessibilityState() {
state |= A11Y_STICKY_KEYS; state |= A11Y_STICKY_KEYS;
if (controller->IsSelectToSpeakEnabled()) if (controller->IsSelectToSpeakEnabled())
state |= A11Y_SELECT_TO_SPEAK; state |= A11Y_SELECT_TO_SPEAK;
if (controller->IsDictationEnabled())
state |= A11Y_DICTATION;
if (features::IsDockedMagnifierEnabled() && if (features::IsDockedMagnifierEnabled() &&
Shell::Get()->docked_magnifier_controller()->GetEnabled()) { Shell::Get()->docked_magnifier_controller()->GetEnabled()) {
state |= A11Y_DOCKED_MAGNIFIER; state |= A11Y_DOCKED_MAGNIFIER;
...@@ -148,6 +151,12 @@ void AccessibilityDetailedView::OnAccessibilityStatusChanged() { ...@@ -148,6 +151,12 @@ void AccessibilityDetailedView::OnAccessibilityStatusChanged() {
TrayPopupUtils::UpdateCheckMarkVisibility(select_to_speak_view_, TrayPopupUtils::UpdateCheckMarkVisibility(select_to_speak_view_,
select_to_speak_enabled_); select_to_speak_enabled_);
if (dictation_view_) {
dictation_enabled_ = controller->IsDictationEnabled();
TrayPopupUtils::UpdateCheckMarkVisibility(dictation_view_,
dictation_enabled_);
}
high_contrast_enabled_ = controller->IsHighContrastEnabled(); high_contrast_enabled_ = controller->IsHighContrastEnabled();
TrayPopupUtils::UpdateCheckMarkVisibility(high_contrast_view_, TrayPopupUtils::UpdateCheckMarkVisibility(high_contrast_view_,
high_contrast_enabled_); high_contrast_enabled_);
...@@ -219,6 +228,15 @@ void AccessibilityDetailedView::AppendAccessibilityList() { ...@@ -219,6 +228,15 @@ void AccessibilityDetailedView::AppendAccessibilityList() {
IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SELECT_TO_SPEAK), IDS_ASH_STATUS_TRAY_ACCESSIBILITY_SELECT_TO_SPEAK),
select_to_speak_enabled_); select_to_speak_enabled_);
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kEnableExperimentalAccessibilityFeatures)) {
dictation_enabled_ = controller->IsDictationEnabled();
dictation_view_ = AddScrollListCheckableItem(
kDictationOffIcon, // Need to get Chrome UI Review to comment on this
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBILITY_DICTATION),
dictation_enabled_);
}
high_contrast_enabled_ = controller->IsHighContrastEnabled(); high_contrast_enabled_ = controller->IsHighContrastEnabled();
high_contrast_view_ = AddScrollListCheckableItem( high_contrast_view_ = AddScrollListCheckableItem(
kSystemMenuAccessibilityContrastIcon, kSystemMenuAccessibilityContrastIcon,
...@@ -317,6 +335,11 @@ void AccessibilityDetailedView::HandleViewClicked(views::View* view) { ...@@ -317,6 +335,11 @@ void AccessibilityDetailedView::HandleViewClicked(views::View* view) {
? UserMetricsAction("StatusArea_SelectToSpeakEnabled") ? UserMetricsAction("StatusArea_SelectToSpeakEnabled")
: UserMetricsAction("StatusArea_SelectToSpeakDisabled")); : UserMetricsAction("StatusArea_SelectToSpeakDisabled"));
controller->SetSelectToSpeakEnabled(new_state); controller->SetSelectToSpeakEnabled(new_state);
} else if (view == dictation_view_) {
bool new_state = !controller->IsDictationEnabled();
RecordAction(new_state ? UserMetricsAction("StatusArea_DictationEnabled")
: UserMetricsAction("StatusArea_DictationDisabled"));
controller->SetDictationEnabled(new_state);
} else if (view == high_contrast_view_) { } else if (view == high_contrast_view_) {
bool new_state = !controller->IsHighContrastEnabled(); bool new_state = !controller->IsHighContrastEnabled();
RecordAction(new_state RecordAction(new_state
......
...@@ -64,6 +64,7 @@ class AccessibilityDetailedView : public TrayDetailsView { ...@@ -64,6 +64,7 @@ class AccessibilityDetailedView : public TrayDetailsView {
HoverHighlightView* spoken_feedback_view_ = nullptr; HoverHighlightView* spoken_feedback_view_ = nullptr;
HoverHighlightView* select_to_speak_view_ = nullptr; HoverHighlightView* select_to_speak_view_ = nullptr;
HoverHighlightView* dictation_view_ = nullptr;
HoverHighlightView* high_contrast_view_ = nullptr; HoverHighlightView* high_contrast_view_ = nullptr;
HoverHighlightView* screen_magnifier_view_ = nullptr; HoverHighlightView* screen_magnifier_view_ = nullptr;
HoverHighlightView* docked_magnifier_view_ = nullptr; HoverHighlightView* docked_magnifier_view_ = nullptr;
...@@ -81,6 +82,7 @@ class AccessibilityDetailedView : public TrayDetailsView { ...@@ -81,6 +82,7 @@ class AccessibilityDetailedView : public TrayDetailsView {
// These exist for tests. The canonical state is stored in prefs. // These exist for tests. The canonical state is stored in prefs.
bool spoken_feedback_enabled_ = false; bool spoken_feedback_enabled_ = false;
bool select_to_speak_enabled_ = false; bool select_to_speak_enabled_ = false;
bool dictation_enabled_ = false;
bool high_contrast_enabled_ = false; bool high_contrast_enabled_ = false;
bool screen_magnifier_enabled_ = false; bool screen_magnifier_enabled_ = false;
bool docked_magnifier_enabled_ = false; bool docked_magnifier_enabled_ = false;
......
...@@ -271,6 +271,9 @@ ...@@ -271,6 +271,9 @@
<message name="IDS_SETTINGS_ON_SCREEN_KEYBOARD_LABEL" desc="Label for checkbox which enables an on-screen keyboard."> <message name="IDS_SETTINGS_ON_SCREEN_KEYBOARD_LABEL" desc="Label for checkbox which enables an on-screen keyboard.">
Enable on-screen keyboard Enable on-screen keyboard
</message> </message>
<message name="IDS_SETTINGS_ACCESSIBILITY_DICTATION_LABEL" desc="Label for checkbox which enables the ability to speak into text fields">
Enable dictation (speak to type)
</message>
<message name="IDS_SETTINGS_MONO_AUDIO_LABEL" desc="Label for checkbox which enables mono audio output."> <message name="IDS_SETTINGS_MONO_AUDIO_LABEL" desc="Label for checkbox which enables mono audio output.">
Play the same audio through all speakers (mono audio) Play the same audio through all speakers (mono audio)
</message> </message>
...@@ -310,6 +313,9 @@ ...@@ -310,6 +313,9 @@
<message name="IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_HEADING" desc="In the settings tab, the heading above settings related to the keyboard."> <message name="IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_HEADING" desc="In the settings tab, the heading above settings related to the keyboard.">
Keyboard Keyboard
</message> </message>
<message name="IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_AND_TEXT_INPUT_HEADING" desc="In the settings tab, the heading above settings related to the keyboard and other text input.">
Keyboard and text input
</message>
<message name="IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_SETTINGS_TITLE" desc="In the settings tab, the title of a link to open keyboard settings."> <message name="IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_SETTINGS_TITLE" desc="In the settings tab, the title of a link to open keyboard settings.">
Open keyboard device settings Open keyboard device settings
</message> </message>
......
...@@ -309,6 +309,7 @@ bool AccessibilityManager::ShouldShowAccessibilityMenu() { ...@@ -309,6 +309,7 @@ bool AccessibilityManager::ShouldShowAccessibilityMenu() {
prefs->GetBoolean(ash::prefs::kAccessibilityCaretHighlightEnabled) || prefs->GetBoolean(ash::prefs::kAccessibilityCaretHighlightEnabled) ||
prefs->GetBoolean(ash::prefs::kAccessibilityCursorHighlightEnabled) || prefs->GetBoolean(ash::prefs::kAccessibilityCursorHighlightEnabled) ||
prefs->GetBoolean(ash::prefs::kAccessibilityFocusHighlightEnabled) || prefs->GetBoolean(ash::prefs::kAccessibilityFocusHighlightEnabled) ||
prefs->GetBoolean(ash::prefs::kAccessibilityDictationEnabled) ||
prefs->GetBoolean(ash::prefs::kDockedMagnifierEnabled)) { prefs->GetBoolean(ash::prefs::kDockedMagnifierEnabled)) {
return true; return true;
} }
......
...@@ -209,6 +209,9 @@ void Preferences::RegisterProfilePrefs( ...@@ -209,6 +209,9 @@ void Preferences::RegisterProfilePrefs(
registry->RegisterBooleanPref( registry->RegisterBooleanPref(
ash::prefs::kAccessibilityScreenMagnifierEnabled, false, ash::prefs::kAccessibilityScreenMagnifierEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF | PrefRegistry::PUBLIC); user_prefs::PrefRegistrySyncable::SYNCABLE_PREF | PrefRegistry::PUBLIC);
registry->RegisterBooleanPref(
ash::prefs::kAccessibilityDictationEnabled, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF | PrefRegistry::PUBLIC);
registry->RegisterDoublePref(ash::prefs::kAccessibilityScreenMagnifierScale, registry->RegisterDoublePref(ash::prefs::kAccessibilityScreenMagnifierScale,
std::numeric_limits<double>::min(), std::numeric_limits<double>::min(),
PrefRegistry::PUBLIC); PrefRegistry::PUBLIC);
......
...@@ -284,6 +284,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() { ...@@ -284,6 +284,8 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_BOOLEAN; settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[ash::prefs::kShouldAlwaysShowAccessibilityMenu] = (*s_whitelist)[ash::prefs::kShouldAlwaysShowAccessibilityMenu] =
settings_api::PrefType::PREF_TYPE_BOOLEAN; settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[ash::prefs::kAccessibilityDictationEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[ash::prefs::kAccessibilityFocusHighlightEnabled] = (*s_whitelist)[ash::prefs::kAccessibilityFocusHighlightEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN; settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[ash::prefs::kAccessibilityHighContrastEnabled] = (*s_whitelist)[ash::prefs::kAccessibilityHighContrastEnabled] =
......
...@@ -142,7 +142,12 @@ ...@@ -142,7 +142,12 @@
</paper-icon-button-light> </paper-icon-button-light>
</div> </div>
<h2>$i18n{keyboardHeading}</h2> <template is="dom-if" if="[[!showExperimentalFeatures_]]">
<h2>$i18n{keyboardHeading}</h2>
</template>
<template is="dom-if" if="[[showExperimentalFeatures_]]">
<h2>$i18n{keyboardAndTextInputHeading}</h2>
</template>
<settings-toggle-button class="first" <settings-toggle-button class="first"
pref="{{prefs.settings.a11y.sticky_keys_enabled}}" pref="{{prefs.settings.a11y.sticky_keys_enabled}}"
label="$i18n{stickyKeysLabel}"> label="$i18n{stickyKeysLabel}">
...@@ -151,6 +156,12 @@ ...@@ -151,6 +156,12 @@
pref="{{prefs.settings.a11y.virtual_keyboard}}" pref="{{prefs.settings.a11y.virtual_keyboard}}"
label="$i18n{onScreenKeyboardLabel}"> label="$i18n{onScreenKeyboardLabel}">
</settings-toggle-button> </settings-toggle-button>
<template is="dom-if" if="[[showExperimentalFeatures_]]">
<settings-toggle-button class="continuation"
pref="{{prefs.settings.a11y.dictation}}"
label="$i18n{dictationLabel}">
</settings-toggle-button>
</template>
<settings-toggle-button class="continuation" <settings-toggle-button class="continuation"
pref="{{prefs.settings.a11y.focus_highlight}}" pref="{{prefs.settings.a11y.focus_highlight}}"
label="$i18n{focusHighlightLabel}"> label="$i18n{focusHighlightLabel}">
......
...@@ -195,6 +195,7 @@ void AddA11yStrings(content::WebUIDataSource* html_source) { ...@@ -195,6 +195,7 @@ void AddA11yStrings(content::WebUIDataSource* html_source) {
{"delayBeforeClickShort", IDS_SETTINGS_DELAY_BEFORE_CLICK_SHORT}, {"delayBeforeClickShort", IDS_SETTINGS_DELAY_BEFORE_CLICK_SHORT},
{"delayBeforeClickLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_LONG}, {"delayBeforeClickLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_LONG},
{"delayBeforeClickVeryLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_VERY_LONG}, {"delayBeforeClickVeryLong", IDS_SETTINGS_DELAY_BEFORE_CLICK_VERY_LONG},
{"dictationLabel", IDS_SETTINGS_ACCESSIBILITY_DICTATION_LABEL},
{"onScreenKeyboardLabel", IDS_SETTINGS_ON_SCREEN_KEYBOARD_LABEL}, {"onScreenKeyboardLabel", IDS_SETTINGS_ON_SCREEN_KEYBOARD_LABEL},
{"monoAudioLabel", IDS_SETTINGS_MONO_AUDIO_LABEL}, {"monoAudioLabel", IDS_SETTINGS_MONO_AUDIO_LABEL},
{"a11yExplanation", IDS_SETTINGS_ACCESSIBILITY_EXPLANATION}, {"a11yExplanation", IDS_SETTINGS_ACCESSIBILITY_EXPLANATION},
...@@ -224,6 +225,8 @@ void AddA11yStrings(content::WebUIDataSource* html_source) { ...@@ -224,6 +225,8 @@ void AddA11yStrings(content::WebUIDataSource* html_source) {
{"appearanceSettingsDescription", {"appearanceSettingsDescription",
IDS_SETTINGS_ACCESSIBILITY_APPEARANCE_SETTINGS_DESCRIPTION}, IDS_SETTINGS_ACCESSIBILITY_APPEARANCE_SETTINGS_DESCRIPTION},
{"keyboardHeading", IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_HEADING}, {"keyboardHeading", IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_HEADING},
{"keyboardAndTextInputHeading",
IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_AND_TEXT_INPUT_HEADING},
{"keyboardSettingsTitle", {"keyboardSettingsTitle",
IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_SETTINGS_TITLE}, IDS_SETTINGS_ACCESSIBILITY_KEYBOARD_SETTINGS_TITLE},
{"keyboardSettingsDescription", {"keyboardSettingsDescription",
......
...@@ -18170,6 +18170,16 @@ should be able to be added at any place in this file. ...@@ -18170,6 +18170,16 @@ should be able to be added at any place in this file.
</description> </description>
</action> </action>
<action name="StatusArea_DictationDisabled">
<owner>zhelfins@chromium.org</owner>
<description>Ash system menu: Accessibility: Disable Dictation.</description>
</action>
<action name="StatusArea_DictationEnabled">
<owner>zhelfins@chromium.org</owner>
<description>Ash system menu: Accessibility: Enable Dictation.</description>
</action>
<action name="StatusArea_Display_Default_Selected"> <action name="StatusArea_Display_Default_Selected">
<owner>bruthig@chromium.org</owner> <owner>bruthig@chromium.org</owner>
<owner>tbuckley@chromium.org</owner> <owner>tbuckley@chromium.org</owner>
......
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