Skip to content

Commit

Permalink
Add flag to enable Search+S to read selected text in Select-to-Speak.
Browse files Browse the repository at this point in the history
Once the feature is approved this can be reverted and the feature
can simply be enabled always. This makes the feature accessible for
testing until it is done with the approval process.

Bug: 713303
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I058bfd5f8d67d88f96061ec469688d7454aef650
Reviewed-on: https://chromium-review.googlesource.com/857689
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528806}
  • Loading branch information
dektar authored and Commit Bot committed Jan 11, 2018
1 parent d74c23a commit 6923c32
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 6 deletions.
3 changes: 3 additions & 0 deletions chrome/app/settings_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@
<message name="IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION" desc="In the settings tab, the description of an option to hold a key and click or drag a box with the mouse to speak any on-screen text out loud.">
Press and hold Search, then click or drag to select content to be read aloud
</message>
<message name="IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION_FLAGS" desc="In the settings tab, the description of an option to hold a key and click or drag a box with the mouse, or highlight a region and press a keystroke, to speak any on-screen text out loud.">
To read content aloud, press and hold Search, then click or drag to select content. Or highlight a region and use Search + S.
</message>
<message name="IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_OPTIONS_LABEL" desc="In the settings tab, the label for the button that opens the Options page for the Select-to-Speak feature.">
Open select-to-speak settings
</message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'<(EXTERNS_GYP):accessibility_private',
'<(EXTERNS_GYP):automation',
'<(EXTERNS_GYP):chrome_extensions',
'<(EXTERNS_GYP):command_line_private',
'<(EXTERNS_GYP):metrics_private',
],
'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"permissions": [
"accessibilityPrivate",
"commandLinePrivate",
"metricsPrivate",
"storage",
"tts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ var AutomationEvent = chrome.automation.AutomationEvent;
var EventType = chrome.automation.EventType;
var RoleType = chrome.automation.RoleType;

// Whether reading selected text is enabled.
const READ_SELECTION_ENABLED = false;

// CrosSelectToSpeakStartSpeechMethod enums.
// These values are persited to logs and should not be renumbered or re-used.
// See tools/metrics/histograms/enums.xml.
Expand Down Expand Up @@ -397,7 +394,15 @@ var SelectToSpeak = function() {
*/
this.intervalId_;

this.readSelectionEnabled_ = READ_SELECTION_ENABLED;
// Enable reading selection at keystroke when experimental accessibility
// features are enabled.
// TODO(katie): When the feature is approved, remove this variable and
// callback. The feature will be always enabled.
this.readSelectionEnabled_ = false;
chrome.commandLinePrivate.hasSwitch(
'enable-experimental-accessibility-features', (result) => {
this.readSelectionEnabled_ = result;
});

this.initPreferences_();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ chrome.metricsPrivate = {
recordValue: function() {},
MetricTypeType: {HISTOGRAM_LINEAR: 1}
};

chrome.commandLinePrivate = {
hasSwitch: function() {}
};
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ void AddCommonStrings(content::WebUIDataSource* html_source, Profile* profile) {
}

void AddA11yStrings(content::WebUIDataSource* html_source) {
#if defined(OS_CHROMEOS)
// The content description for select to speak is dependent on a flag
// until a feature launch.
// TODO(katie): When the feature is approved, remove this variable and
// callback. The feature will be always enabled.
int selectToSpeakDescription =
(base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kEnableExperimentalAccessibilityFeatures))
? IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION_FLAGS
: IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION;
#endif

LocalizedString localized_strings[] = {
{"a11yPageTitle", IDS_SETTINGS_ACCESSIBILITY},
{"a11yWebStore", IDS_SETTINGS_ACCESSIBILITY_WEB_STORE},
Expand Down Expand Up @@ -173,8 +185,7 @@ void AddA11yStrings(content::WebUIDataSource* html_source) {
{"focusHighlightLabel",
IDS_SETTINGS_ACCESSIBILITY_FOCUS_HIGHLIGHT_DESCRIPTION},
{"selectToSpeakTitle", IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_TITLE},
{"selectToSpeakDescription",
IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_DESCRIPTION},
{"selectToSpeakDescription", selectToSpeakDescription},
{"selectToSpeakOptionsLabel",
IDS_SETTINGS_ACCESSIBILITY_SELECT_TO_SPEAK_OPTIONS_LABEL},
{"switchAccessLabel", IDS_SETTINGS_ACCESSIBILITY_SWITCH_ACCESS_DESCRIPTION},
Expand Down

0 comments on commit 6923c32

Please sign in to comment.