Commit 92fab4aa authored by Katie D's avatar Katie D Committed by Commit Bot

Add @private and @protected to SelectToSpeak JS functions

Change-Id: I730fa92718409b518c9d9ada04e7378f203c40bd
Reviewed-on: https://chromium-review.googlesource.com/c/1257145Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595928}
parent 58d995bb
...@@ -128,8 +128,8 @@ SelectToSpeak.prototype = { ...@@ -128,8 +128,8 @@ SelectToSpeak.prototype = {
* Called in response to our hit test after the mouse is released, * Called in response to our hit test after the mouse is released,
* when the user is in a mode where select-to-speak is capturing * when the user is in a mode where select-to-speak is capturing
* mouse events (for example holding down Search). * mouse events (for example holding down Search).
*
* @param {!AutomationEvent} evt The automation event. * @param {!AutomationEvent} evt The automation event.
* @private
*/ */
onAutomationHitTest_: function(evt) { onAutomationHitTest_: function(evt) {
// Walk up to the nearest window, web area, toolbar, or dialog that the // Walk up to the nearest window, web area, toolbar, or dialog that the
...@@ -175,6 +175,7 @@ SelectToSpeak.prototype = { ...@@ -175,6 +175,7 @@ SelectToSpeak.prototype = {
/** /**
* Queues up selected text for reading by finding the Position objects * Queues up selected text for reading by finding the Position objects
* representing the selection. * representing the selection.
* @private
*/ */
requestSpeakSelectedText_: function(focusedNode) { requestSpeakSelectedText_: function(focusedNode) {
// If nothing is selected, return early. // If nothing is selected, return early.
...@@ -249,6 +250,7 @@ SelectToSpeak.prototype = { ...@@ -249,6 +250,7 @@ SelectToSpeak.prototype = {
* @param {NodeUtils.Position} lastPosition The last position at which to stop * @param {NodeUtils.Position} lastPosition The last position at which to stop
* reading. * reading.
* @param {AutomationNode} focusedNode The node with user focus. * @param {AutomationNode} focusedNode The node with user focus.
* @private
*/ */
readNodesInSelection_: function(firstPosition, lastPosition, focusedNode) { readNodesInSelection_: function(firstPosition, lastPosition, focusedNode) {
let nodes = []; let nodes = [];
...@@ -332,6 +334,7 @@ SelectToSpeak.prototype = { ...@@ -332,6 +334,7 @@ SelectToSpeak.prototype = {
* Gets ready to cancel future scrolling to offscreen nodes as soon as * Gets ready to cancel future scrolling to offscreen nodes as soon as
* a user-initiated scroll is done. * a user-initiated scroll is done.
* @param {AutomationNode=} root The root node to listen for events on. * @param {AutomationNode=} root The root node to listen for events on.
* @private
*/ */
initializeScrollingToOffscreenNodes_: function(root) { initializeScrollingToOffscreenNodes_: function(root) {
if (!root) { if (!root) {
...@@ -355,6 +358,7 @@ SelectToSpeak.prototype = { ...@@ -355,6 +358,7 @@ SelectToSpeak.prototype = {
/** /**
* Plays a tone to let the user know they did the correct * Plays a tone to let the user know they did the correct
* keystroke but nothing was selected. * keystroke but nothing was selected.
* @private
*/ */
onNullSelection_: function() { onNullSelection_: function() {
this.null_selection_tone_.play(); this.null_selection_tone_.play();
...@@ -367,6 +371,7 @@ SelectToSpeak.prototype = { ...@@ -367,6 +371,7 @@ SelectToSpeak.prototype = {
* If speech was not in progress, i.e. if the user was drawing * If speech was not in progress, i.e. if the user was drawing
* a focus ring on the screen, this still clears the visual * a focus ring on the screen, this still clears the visual
* focus ring. * focus ring.
* @private
*/ */
stopAll_: function() { stopAll_: function() {
chrome.tts.stop(); chrome.tts.stop();
...@@ -377,6 +382,7 @@ SelectToSpeak.prototype = { ...@@ -377,6 +382,7 @@ SelectToSpeak.prototype = {
/** /**
* Clears the current focus ring and node, but does * Clears the current focus ring and node, but does
* not stop the speech. * not stop the speech.
* @private
*/ */
clearFocusRingAndNode_: function() { clearFocusRingAndNode_: function() {
this.clearFocusRing_(); this.clearFocusRing_();
...@@ -392,6 +398,7 @@ SelectToSpeak.prototype = { ...@@ -392,6 +398,7 @@ SelectToSpeak.prototype = {
/** /**
* Clears the focus ring, but does not clear the current * Clears the focus ring, but does not clear the current
* node. * node.
* @private
*/ */
clearFocusRing_: function() { clearFocusRing_: function() {
chrome.accessibilityPrivate.setFocusRing([]); chrome.accessibilityPrivate.setFocusRing([]);
...@@ -426,6 +433,7 @@ SelectToSpeak.prototype = { ...@@ -426,6 +433,7 @@ SelectToSpeak.prototype = {
/** /**
* Set up event listeners user input. * Set up event listeners user input.
* @private
*/ */
setUpEventListeners_: function() { setUpEventListeners_: function() {
this.inputHandler_ = new InputHandler({ this.inputHandler_ = new InputHandler({
...@@ -513,6 +521,7 @@ SelectToSpeak.prototype = { ...@@ -513,6 +521,7 @@ SelectToSpeak.prototype = {
* with any particular nodes, so this does not do any work around drawing * with any particular nodes, so this does not do any work around drawing
* focus rings, unlike startSpeechQueue_ below. * focus rings, unlike startSpeechQueue_ below.
* @param {string} text The text to speak. * @param {string} text The text to speak.
* @private
*/ */
startSpeech_: function(text) { startSpeech_: function(text) {
this.prepareForSpeech_(); this.prepareForSpeech_();
...@@ -537,6 +546,7 @@ SelectToSpeak.prototype = { ...@@ -537,6 +546,7 @@ SelectToSpeak.prototype = {
* at which to start speaking. If this is not passed, will start at 0. * at which to start speaking. If this is not passed, will start at 0.
* @param {number=} opt_endIndex The index into the last node's text * @param {number=} opt_endIndex The index into the last node's text
* at which to end speech. If this is not passed, will stop at the end. * at which to end speech. If this is not passed, will stop at the end.
* @private
*/ */
startSpeechQueue_: function(nodes, opt_startIndex, opt_endIndex) { startSpeechQueue_: function(nodes, opt_startIndex, opt_endIndex) {
this.prepareForSpeech_(); this.prepareForSpeech_();
...@@ -652,6 +662,7 @@ SelectToSpeak.prototype = { ...@@ -652,6 +662,7 @@ SelectToSpeak.prototype = {
/** /**
* Prepares for speech. Call once before chrome.tts.speak is called. * Prepares for speech. Call once before chrome.tts.speak is called.
* @private
*/ */
prepareForSpeech_: function() { prepareForSpeech_: function() {
this.cancelIfSpeaking_(true /* clear the focus ring */); this.cancelIfSpeaking_(true /* clear the focus ring */);
...@@ -666,6 +677,7 @@ SelectToSpeak.prototype = { ...@@ -666,6 +677,7 @@ SelectToSpeak.prototype = {
/** /**
* Updates the state. * Updates the state.
* @param {!chrome.accessibilityPrivate.SelectToSpeakState} state * @param {!chrome.accessibilityPrivate.SelectToSpeakState} state
* @private
*/ */
onStateChanged_: function(state) { onStateChanged_: function(state) {
if (this.state_ != state) { if (this.state_ != state) {
...@@ -693,6 +705,7 @@ SelectToSpeak.prototype = { ...@@ -693,6 +705,7 @@ SelectToSpeak.prototype = {
* where cancel is called twice. * where cancel is called twice.
* @param {boolean} clearFocusRing Whether to clear the focus ring * @param {boolean} clearFocusRing Whether to clear the focus ring
* as well. * as well.
* @private
*/ */
cancelIfSpeaking_: function(clearFocusRing) { cancelIfSpeaking_: function(clearFocusRing) {
chrome.tts.isSpeaking(MetricsUtils.recordCancelIfSpeaking); chrome.tts.isSpeaking(MetricsUtils.recordCancelIfSpeaking);
...@@ -711,6 +724,7 @@ SelectToSpeak.prototype = { ...@@ -711,6 +724,7 @@ SelectToSpeak.prototype = {
* @param {ParagraphUtils.NodeGroupItem} nodeGroupItem The node to use for * @param {ParagraphUtils.NodeGroupItem} nodeGroupItem The node to use for
* updates. * updates.
* @param {boolean} inForeground Whether the node is in the foreground window. * @param {boolean} inForeground Whether the node is in the foreground window.
* @private
*/ */
updateFromNodeState_: function(nodeGroupItem, inForeground) { updateFromNodeState_: function(nodeGroupItem, inForeground) {
switch (NodeUtils.getNodeState(nodeGroupItem.node)) { switch (NodeUtils.getNodeState(nodeGroupItem.node)) {
...@@ -749,6 +763,7 @@ SelectToSpeak.prototype = { ...@@ -749,6 +763,7 @@ SelectToSpeak.prototype = {
* *
* @param {ParagraphUtils.NodeGroupItem} nodeGroupItem The node to use for * @param {ParagraphUtils.NodeGroupItem} nodeGroupItem The node to use for
* updates. * updates.
* @private
*/ */
updateHighlightAndFocus_: function(nodeGroupItem) { updateHighlightAndFocus_: function(nodeGroupItem) {
if (!this.visible_) { if (!this.visible_) {
...@@ -798,6 +813,7 @@ SelectToSpeak.prototype = { ...@@ -798,6 +813,7 @@ SelectToSpeak.prototype = {
/** /**
* Tests the active node to make sure the bounds are drawn correctly. * Tests the active node to make sure the bounds are drawn correctly.
* @private
*/ */
testCurrentNode_: function() { testCurrentNode_: function() {
if (this.currentNode_ == null) { if (this.currentNode_ == null) {
...@@ -822,6 +838,7 @@ SelectToSpeak.prototype = { ...@@ -822,6 +838,7 @@ SelectToSpeak.prototype = {
/** /**
* Checks that the current node is in the same window as the HitTest node. * Checks that the current node is in the same window as the HitTest node.
* Uses this information to update Select-To-Speak from node state. * Uses this information to update Select-To-Speak from node state.
* @private
*/ */
onHitTestCheckCurrentNodeMatches_: function(evt) { onHitTestCheckCurrentNodeMatches_: function(evt) {
if (this.currentNode_ == null) { if (this.currentNode_ == null) {
...@@ -856,6 +873,7 @@ SelectToSpeak.prototype = { ...@@ -856,6 +873,7 @@ SelectToSpeak.prototype = {
* This takes precedence over the charIndex. * This takes precedence over the charIndex.
* @param {number=} opt_endIndex The index at which to end the highlight. This * @param {number=} opt_endIndex The index at which to end the highlight. This
* takes precedence over the next word end. * takes precedence over the next word end.
* @private
*/ */
updateNodeHighlight_: function( updateNodeHighlight_: function(
text, charIndex, opt_startIndex, opt_endIndex) { text, charIndex, opt_startIndex, opt_endIndex) {
...@@ -895,6 +913,7 @@ SelectToSpeak.prototype = { ...@@ -895,6 +913,7 @@ SelectToSpeak.prototype = {
* Fires a mock key down event for testing. * Fires a mock key down event for testing.
* @param {!Event} event The fake key down event to fire. The object * @param {!Event} event The fake key down event to fire. The object
* must contain at minimum a keyCode. * must contain at minimum a keyCode.
* @protected
*/ */
fireMockKeyDownEvent: function(event) { fireMockKeyDownEvent: function(event) {
this.inputHandler_.onKeyDown_(event); this.inputHandler_.onKeyDown_(event);
...@@ -904,6 +923,7 @@ SelectToSpeak.prototype = { ...@@ -904,6 +923,7 @@ SelectToSpeak.prototype = {
* Fires a mock key up event for testing. * Fires a mock key up event for testing.
* @param {!Event} event The fake key up event to fire. The object * @param {!Event} event The fake key up event to fire. The object
* must contain at minimum a keyCode. * must contain at minimum a keyCode.
* @protected
*/ */
fireMockKeyUpEvent: function(event) { fireMockKeyUpEvent: function(event) {
this.inputHandler_.onKeyUp_(event); this.inputHandler_.onKeyUp_(event);
...@@ -913,6 +933,7 @@ SelectToSpeak.prototype = { ...@@ -913,6 +933,7 @@ SelectToSpeak.prototype = {
* Fires a mock mouse down event for testing. * Fires a mock mouse down event for testing.
* @param {!Event} event The fake mouse down event to fire. The object * @param {!Event} event The fake mouse down event to fire. The object
* must contain at minimum a screenX and a screenY. * must contain at minimum a screenX and a screenY.
* @protected
*/ */
fireMockMouseDownEvent: function(event) { fireMockMouseDownEvent: function(event) {
this.inputHandler_.onMouseDown_(event); this.inputHandler_.onMouseDown_(event);
...@@ -922,6 +943,7 @@ SelectToSpeak.prototype = { ...@@ -922,6 +943,7 @@ SelectToSpeak.prototype = {
* Fires a mock mouse up event for testing. * Fires a mock mouse up event for testing.
* @param {!Event} event The fake mouse up event to fire. The object * @param {!Event} event The fake mouse up event to fire. The object
* must contain at minimum a screenX and a screenY. * must contain at minimum a screenX and a screenY.
* @protected
*/ */
fireMockMouseUpEvent: function(event) { fireMockMouseUpEvent: function(event) {
this.inputHandler_.onMouseUp_(event); this.inputHandler_.onMouseUp_(event);
...@@ -931,6 +953,7 @@ SelectToSpeak.prototype = { ...@@ -931,6 +953,7 @@ SelectToSpeak.prototype = {
* Function to be called when a state change request is received from the * Function to be called when a state change request is received from the
* accessibilityPrivate API. * accessibilityPrivate API.
* @type {?function()} * @type {?function()}
* @protected
*/ */
onStateChangeRequestedCallbackForTest_: null, onStateChangeRequestedCallbackForTest_: null,
}; };
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