Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/nav_description.js

Issue 604423002: Use an enum for ChromeVox queue mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview A simple container object for the description of a 6 * @fileoverview A simple container object for the description of a
7 * navigation from one object to another. 7 * navigation from one object to another.
8 * 8 *
9 */ 9 */
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 * @param {number} earconId An earcon id to be pushed on to the list of earcon 83 * @param {number} earconId An earcon id to be pushed on to the list of earcon
84 * ids to play along with the spoken description of this object. 84 * ids to play along with the spoken description of this object.
85 */ 85 */
86 cvox.NavDescription.prototype.pushEarcon = function(earconId) { 86 cvox.NavDescription.prototype.pushEarcon = function(earconId) {
87 this.earcons.push(earconId); 87 this.earcons.push(earconId);
88 }; 88 };
89 89
90 90
91 /** 91 /**
92 * Speak this nav description with the given queue mode. 92 * Speak this nav description with the given queue mode.
93 * @param {number=} queueMode The queue mode: cvox.AbstractTts.QUEUE_MODE_FLUSH 93 * @param {cvox.QueueMode=} queueMode The queue mode.
94 * for flush, cvox.AbstractTts.QUEUE_MODE_QUEUE for adding to queue.
95 * @param {function()=} startCallback Function called when this starts speaking. 94 * @param {function()=} startCallback Function called when this starts speaking.
96 * @param {function()=} endCallback Function called when this ends speaking. 95 * @param {function()=} endCallback Function called when this ends speaking.
Peter Lundblad 2014/09/29 13:51:04 nit: optional parameters should have opt_ prepende
dmazzoni 2014/09/30 22:01:20 Done.
97 */ 96 */
98 cvox.NavDescription.prototype.speak = function( 97 cvox.NavDescription.prototype.speak = function(
99 queueMode, startCallback, endCallback) { 98 queueMode, startCallback, endCallback) {
100 /** 99 /**
101 * Return a deep copy of PERSONALITY_ANNOTATION for modifying. 100 * Return a deep copy of PERSONALITY_ANNOTATION for modifying.
102 * @return {Object} The newly created properties object. 101 * @return {Object} The newly created properties object.
103 */ 102 */
104 function makeAnnotationProps() { 103 function makeAnnotationProps() {
105 var properties = {}; 104 var properties = {};
106 var src = cvox.AbstractTts.PERSONALITY_ANNOTATION; 105 var src = cvox.AbstractTts.PERSONALITY_ANNOTATION;
107 for (var key in src) { 106 for (var key in src) {
108 properties[key] = src[key]; 107 properties[key] = src[key];
109 } 108 }
110 return properties; 109 return properties;
111 } 110 }
112 111
113 var speakArgs = new Array(); 112 var speakArgs = new Array();
114 if (this.context) { 113 if (this.context) {
115 speakArgs.push([this.context, queueMode, makeAnnotationProps()]); 114 speakArgs.push([this.context, queueMode, makeAnnotationProps()]);
116 queueMode = 1; 115 queueMode = cvox.QueueMode.QUEUE;
117 } 116 }
118 117
119 speakArgs.push([this.text, 118 speakArgs.push([this.text,
120 queueMode, 119 queueMode,
121 this.personality ? this.personality : {}]); 120 this.personality ? this.personality : {}]);
122 queueMode = 1; 121 queueMode = cvox.QueueMode.QUEUE;
123 122
124 if (this.userValue) { 123 if (this.userValue) {
125 speakArgs.push([this.userValue, queueMode, {}]); 124 speakArgs.push([this.userValue, queueMode, {}]);
126 } 125 }
127 126
128 if (this.annotation) { 127 if (this.annotation) {
129 speakArgs.push([this.annotation, queueMode, makeAnnotationProps()]); 128 speakArgs.push([this.annotation, queueMode, makeAnnotationProps()]);
130 } 129 }
131 130
132 if (this.hint) { 131 if (this.hint) {
(...skipping 20 matching lines...) Expand all
153 * Compares two NavDescriptions. 152 * Compares two NavDescriptions.
154 * @param {cvox.NavDescription} that A NavDescription. 153 * @param {cvox.NavDescription} that A NavDescription.
155 * @return {boolean} True if equal. 154 * @return {boolean} True if equal.
156 */ 155 */
157 cvox.NavDescription.prototype.equals = function(that) { 156 cvox.NavDescription.prototype.equals = function(that) {
158 return this.context == that.context && 157 return this.context == that.context &&
159 this.text == that.text && 158 this.text == that.text &&
160 this.userValue == that.userValue && 159 this.userValue == that.userValue &&
161 this.annotation == that.annotation; 160 this.annotation == that.annotation;
162 }; 161 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698