Commit 32f6e145 authored by Katie D's avatar Katie D Committed by Commit Bot

Adds cursor color to settings behind a flag.

No translation screenshots as this is not yet UX approved.

cursor colors in chromebook a11y settings.

AX-Relnotes: Users with cursor color flag enabled can now change their
Bug: 1085442
Change-Id: I583f6b28ea69387e598e595b513bf4cf6928bbd8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220492
Commit-Queue: Katie Dektar <katie@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774359}
parent 73e20b99
...@@ -894,6 +894,9 @@ ...@@ -894,6 +894,9 @@
<message name="IDS_OS_SETTINGS_TAG_A11y_CHROMEVOX_ALT1" desc="Text for search result item which, when clicked, navigates the user to accessibility settings, with a toggle to enable/disable ChromeVox (spoken feedback). Alternate phrase for: 'ChromeVox (spoken feedback)'"> <message name="IDS_OS_SETTINGS_TAG_A11y_CHROMEVOX_ALT1" desc="Text for search result item which, when clicked, navigates the user to accessibility settings, with a toggle to enable/disable ChromeVox (spoken feedback). Alternate phrase for: 'ChromeVox (spoken feedback)'">
Screen reader Screen reader
</message> </message>
<message name="IDS_OS_SETTINGS_TAG_A11Y_CURSOR_COLOR" desc="Text for search result item which, when clicked, navigates the user to accessibility settings, with a toggle to enable/disable custom cursor colors.">
Cursor color
</message>
<message name="IDS_OS_SETTINGS_TAG_A11Y_SELECT_TO_SPEAK" desc="Text for search result item which, when clicked, navigates the user to accessibility settings, with a toggle to enable/disable select-to-speak (hearing text read aloud after it is selected)."> <message name="IDS_OS_SETTINGS_TAG_A11Y_SELECT_TO_SPEAK" desc="Text for search result item which, when clicked, navigates the user to accessibility settings, with a toggle to enable/disable select-to-speak (hearing text read aloud after it is selected).">
Select-to-speak Select-to-speak
</message> </message>
......
...@@ -478,6 +478,27 @@ ...@@ -478,6 +478,27 @@
<message name="IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_LARGE_LABEL" desc="Label in the slider which indicates that this side makes the cursor large."> <message name="IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_LARGE_LABEL" desc="Label in the slider which indicates that this side makes the cursor large.">
Large Large
</message> </message>
<message name="IDS_SETTINGS_CURSOR_COLOR_ENABLED_LABEL" desc="Label for a checkbox which enables selecting custom cursor colors.">
Custom cursor color
</message>
<message name="IDS_SETTINGS_CURSOR_COLOR_OPTIONS_LABEL" desc="Label for a drop-down menu of cursor color options for custom cursor colors.">
Color
</message>
<message name="IDS_SETTINGS_CURSOR_COLOR_RED" desc="Label for a cursor color option which colors the cursor red.">
Red
</message>
<message name="IDS_SETTINGS_CURSOR_COLOR_ORANGE" desc="Label for a cursor color option which colors the cursor orange.">
Orange
</message>
<message name="IDS_SETTINGS_CURSOR_COLOR_GREEN" desc="Label for a cursor color option which colors the cursor green.">
Green
</message>
<message name="IDS_SETTINGS_CURSOR_COLOR_BLUE" desc="Label for a cursor color option which colors the cursor blue.">
Blue
</message>
<message name="IDS_SETTINGS_CURSOR_COLOR_PURPLE" desc="Label for a cursor color option which colors the cursor purple.">
Purple
</message>
<message name="IDS_SETTINGS_HIGH_CONTRAST_LABEL" desc="Label for checkbox which enables high-contrast UI."> <message name="IDS_SETTINGS_HIGH_CONTRAST_LABEL" desc="Label for checkbox which enables high-contrast UI.">
Use high contrast mode Use high contrast mode
</message> </message>
......
...@@ -414,6 +414,10 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() { ...@@ -414,6 +414,10 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
settings_api::PrefType::PREF_TYPE_BOOLEAN; settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[ash::prefs::kAccessibilityLargeCursorDipSize] = (*s_whitelist)[ash::prefs::kAccessibilityLargeCursorDipSize] =
settings_api::PrefType::PREF_TYPE_NUMBER; settings_api::PrefType::PREF_TYPE_NUMBER;
(*s_whitelist)[ash::prefs::kAccessibilityCursorColorEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[ash::prefs::kAccessibilityCursorColor] =
settings_api::PrefType::PREF_TYPE_NUMBER;
(*s_whitelist)[ash::prefs::kAccessibilityScreenMagnifierEnabled] = (*s_whitelist)[ash::prefs::kAccessibilityScreenMagnifierEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN; settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_whitelist)[ash::prefs::kAccessibilityScreenMagnifierScale] = (*s_whitelist)[ash::prefs::kAccessibilityScreenMagnifierScale] =
......
...@@ -242,6 +242,25 @@ ...@@ -242,6 +242,25 @@
label-max="$i18n{largeMouseCursorSizeLargeLabel}"> label-max="$i18n{largeMouseCursorSizeLargeLabel}">
</settings-slider> </settings-slider>
</div> </div>
<template is="dom-if" if="[[shouldShowExperimentalCursorColor_]]">
<settings-toggle-button class="hr"
pref="{{prefs.settings.a11y.cursor_color_enabled}}"
label="$i18n{cursorColorEnabledLabel}">
</settings-toggle-button>
<template is="dom-if"
if="[[prefs.settings.a11y.cursor_color_enabled.value]]">
<div class="settings-box continuation">
<div class="start sub-item settings-box-text"
id="cursorColorOptionsLabel">
$i18n{cursorColorOptionsLabel}
</div>
<settings-dropdown-menu aria-labeledby="cursorColorOptionsLabel"
pref="{{prefs.settings.a11y.cursor_color}}"
menu-options="[[cursorColorOptions_]]">
</settings-dropdown-menu>
</div>
</template>
</template>
<settings-toggle-button <settings-toggle-button
class="hr" class="hr"
pref="{{prefs.settings.a11y.cursor_highlight}}" pref="{{prefs.settings.a11y.cursor_highlight}}"
......
...@@ -98,6 +98,36 @@ Polymer({ ...@@ -98,6 +98,36 @@ Polymer({
}, },
}, },
/** @private {!Array<{name: string, value: number}>} */
cursorColorOptions_: {
readOnly: true,
type: Array,
value() {
return [
{
value: 0xd50000, // Google Red A 700
name: loadTimeData.getString('cursorColorRed'),
},
{
value: 0xff6d00, // Google Orange A 700
name: loadTimeData.getString('cursorColorOrange'),
},
{
value: 0x00c853, // Google Green A 700
name: loadTimeData.getString('cursorColorGreen'),
},
{
value: 0x2962ff, // Google Blue A 700
name: loadTimeData.getString('cursorColorBlue'),
},
{
value: 0xaa00ff, // Google Purple A 700
name: loadTimeData.getString('cursorColorPurple'),
},
];
},
},
allowExperimentalSwitchAccess_: { allowExperimentalSwitchAccess_: {
type: Boolean, type: Boolean,
value() { value() {
...@@ -106,6 +136,15 @@ Polymer({ ...@@ -106,6 +136,15 @@ Polymer({
}, },
}, },
/** @private */
shouldShowExperimentalCursorColor_: {
type: Boolean,
value() {
return loadTimeData.getBoolean(
'showExperimentalAccessibilityCursorColor');
},
},
/** /**
* Whether the user is in kiosk mode. * Whether the user is in kiosk mode.
* @private * @private
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
#include "media/base/media_switches.h" #include "media/base/media_switches.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/accessibility_switches.h" #include "ui/accessibility/accessibility_switches.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h" #include "ui/base/webui/web_ui_util.h"
...@@ -274,6 +275,18 @@ const std::vector<SearchConcept>& GetA11yLiveCaptionSearchConcepts() { ...@@ -274,6 +275,18 @@ const std::vector<SearchConcept>& GetA11yLiveCaptionSearchConcepts() {
return *tags; return *tags;
} }
const std::vector<SearchConcept>& GetA11yCursorColorSearchConcepts() {
static const base::NoDestructor<std::vector<SearchConcept>> tags({
{IDS_OS_SETTINGS_TAG_A11Y_CURSOR_COLOR,
mojom::kManageAccessibilitySubpagePath,
mojom::SearchResultIcon::kA11y,
mojom::SearchResultDefaultRank::kMedium,
mojom::SearchResultType::kSetting,
{.setting = mojom::Setting::kEnableCursorColor}},
});
return *tags;
}
bool AreExperimentalA11yLabelsAllowed() { bool AreExperimentalA11yLabelsAllowed() {
return base::FeatureList::IsEnabled( return base::FeatureList::IsEnabled(
::features::kExperimentalAccessibilityLabels); ::features::kExperimentalAccessibilityLabels);
...@@ -283,6 +296,10 @@ bool AreLiveCaptionsAllowed() { ...@@ -283,6 +296,10 @@ bool AreLiveCaptionsAllowed() {
return base::FeatureList::IsEnabled(media::kLiveCaption); return base::FeatureList::IsEnabled(media::kLiveCaption);
} }
bool IsCursorColorAllowed() {
return features::IsAccessibilityCursorColorEnabled();
}
bool IsSwitchAccessAllowed() { bool IsSwitchAccessAllowed() {
return base::CommandLine::ForCurrentProcess()->HasSwitch( return base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kEnableExperimentalAccessibilitySwitchAccess); ::switches::kEnableExperimentalAccessibilitySwitchAccess);
...@@ -339,6 +356,13 @@ void AccessibilitySection::AddLoadTimeData( ...@@ -339,6 +356,13 @@ void AccessibilitySection::AddLoadTimeData(
IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_DEFAULT_LABEL}, IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_DEFAULT_LABEL},
{"largeMouseCursorSizeLargeLabel", {"largeMouseCursorSizeLargeLabel",
IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_LARGE_LABEL}, IDS_SETTINGS_LARGE_MOUSE_CURSOR_SIZE_LARGE_LABEL},
{"cursorColorEnabledLabel", IDS_SETTINGS_CURSOR_COLOR_ENABLED_LABEL},
{"cursorColorOptionsLabel", IDS_SETTINGS_CURSOR_COLOR_OPTIONS_LABEL},
{"cursorColorRed", IDS_SETTINGS_CURSOR_COLOR_RED},
{"cursorColorOrange", IDS_SETTINGS_CURSOR_COLOR_ORANGE},
{"cursorColorGreen", IDS_SETTINGS_CURSOR_COLOR_GREEN},
{"cursorColorBlue", IDS_SETTINGS_CURSOR_COLOR_BLUE},
{"cursorColorPurple", IDS_SETTINGS_CURSOR_COLOR_PURPLE},
{"highContrastLabel", IDS_SETTINGS_HIGH_CONTRAST_LABEL}, {"highContrastLabel", IDS_SETTINGS_HIGH_CONTRAST_LABEL},
{"stickyKeysLabel", IDS_SETTINGS_STICKY_KEYS_LABEL}, {"stickyKeysLabel", IDS_SETTINGS_STICKY_KEYS_LABEL},
{"chromeVoxLabel", IDS_SETTINGS_CHROMEVOX_LABEL}, {"chromeVoxLabel", IDS_SETTINGS_CHROMEVOX_LABEL},
...@@ -517,6 +541,9 @@ void AccessibilitySection::AddLoadTimeData( ...@@ -517,6 +541,9 @@ void AccessibilitySection::AddLoadTimeData(
html_source->AddBoolean("enableLiveCaption", AreLiveCaptionsAllowed()); html_source->AddBoolean("enableLiveCaption", AreLiveCaptionsAllowed());
html_source->AddBoolean("showExperimentalAccessibilityCursorColor",
IsCursorColorAllowed());
::settings::AddCaptionSubpageStrings(html_source); ::settings::AddCaptionSubpageStrings(html_source);
} }
...@@ -575,6 +602,7 @@ void AccessibilitySection::RegisterHierarchy( ...@@ -575,6 +602,7 @@ void AccessibilitySection::RegisterHierarchy(
mojom::Setting::kStartupSound, mojom::Setting::kStartupSound,
mojom::Setting::kGetImageDescriptionsFromGoogle, mojom::Setting::kGetImageDescriptionsFromGoogle,
mojom::Setting::kLiveCaptions, mojom::Setting::kLiveCaptions,
mojom::Setting::kEnableCursorColor,
}; };
RegisterNestedSettingBulk(mojom::Subpage::kManageAccessibility, RegisterNestedSettingBulk(mojom::Subpage::kManageAccessibility,
kManageAccessibilitySettings, generator); kManageAccessibilitySettings, generator);
...@@ -631,6 +659,12 @@ void AccessibilitySection::UpdateSearchTags() { ...@@ -631,6 +659,12 @@ void AccessibilitySection::UpdateSearchTags() {
registry()->RemoveSearchTags(GetA11yLiveCaptionSearchConcepts()); registry()->RemoveSearchTags(GetA11yLiveCaptionSearchConcepts());
} }
if (IsCursorColorAllowed()) {
registry()->AddSearchTags(GetA11yCursorColorSearchConcepts());
} else {
registry()->RemoveSearchTags(GetA11yCursorColorSearchConcepts());
}
if (!IsSwitchAccessAllowed()) if (!IsSwitchAccessAllowed())
return; return;
......
...@@ -181,6 +181,7 @@ enum Setting { ...@@ -181,6 +181,7 @@ enum Setting {
kSwitchActionAutoScanKeyboard = 1525, kSwitchActionAutoScanKeyboard = 1525,
kGetImageDescriptionsFromGoogle = 1526, kGetImageDescriptionsFromGoogle = 1526,
kLiveCaptions = 1527, kLiveCaptions = 1527,
kEnableCursorColor = 1528,
// Reset section. // Reset section.
kPowerwash = 1600, kPowerwash = 1600,
......
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