| OLD | NEW |
| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 this.personality = kwargs.personality; | 51 this.personality = kwargs.personality; |
| 52 this.hint = kwargs.hint ? kwargs.hint : ''; | 52 this.hint = kwargs.hint ? kwargs.hint : ''; |
| 53 this.category = kwargs.category ? kwargs.category : null; | 53 this.category = kwargs.category ? kwargs.category : null; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * @return {boolean} true if this description is empty. | 58 * @return {boolean} true if this description is empty. |
| 59 */ | 59 */ |
| 60 cvox.NavDescription.prototype.isEmpty = function() { | 60 cvox.NavDescription.prototype.isEmpty = function() { |
| 61 return (this.context.length == 0 && | 61 return ( |
| 62 this.earcons.length == 0 && | 62 this.context.length == 0 && this.earcons.length == 0 && |
| 63 this.text.length == 0 && | 63 this.text.length == 0 && this.userValue.length == 0 && |
| 64 this.userValue.length == 0 && | 64 this.annotation.length == 0); |
| 65 this.annotation.length == 0); | |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 | 67 |
| 69 /** | 68 /** |
| 70 * @return {string} A string representation of this object. | 69 * @return {string} A string representation of this object. |
| 71 */ | 70 */ |
| 72 cvox.NavDescription.prototype.toString = function() { | 71 cvox.NavDescription.prototype.toString = function() { |
| 73 return 'NavDescription(context="' + this.context + '" ' + | 72 return 'NavDescription(context="' + this.context + '" ' + |
| 74 ' text="' + this.text + '" ' + | 73 ' text="' + this.text + '" ' + |
| 75 ' userValue="' + this.userValue + '" ' + | 74 ' userValue="' + this.userValue + '" ' + |
| 76 ' annotation="' + this.annotation + | 75 ' annotation="' + this.annotation + |
| 77 (this.category ? '" category="' + this.category + '")' : '') + | 76 (this.category ? '" category="' + this.category + '")' : '') + '")'; |
| 78 '")'; | |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 | 79 |
| 82 /** | 80 /** |
| 83 * Modifies the earcon to play along with the spoken description of the object. | 81 * Modifies the earcon to play along with the spoken description of the object. |
| 84 * @param {cvox.Earcon} earconId An earcon id to be pushed on to the list of | 82 * @param {cvox.Earcon} earconId An earcon id to be pushed on to the list of |
| 85 * earcon ids to play along with the spoken description of this object. | 83 * earcon ids to play along with the spoken description of this object. |
| 86 */ | 84 */ |
| 87 cvox.NavDescription.prototype.pushEarcon = function(earconId) { | 85 cvox.NavDescription.prototype.pushEarcon = function(earconId) { |
| 88 this.earcons.push(earconId); | 86 this.earcons.push(earconId); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 110 } | 108 } |
| 111 return properties; | 109 return properties; |
| 112 } | 110 } |
| 113 | 111 |
| 114 var speakArgs = new Array(); | 112 var speakArgs = new Array(); |
| 115 if (this.context) { | 113 if (this.context) { |
| 116 speakArgs.push([this.context, queueMode, makeAnnotationProps()]); | 114 speakArgs.push([this.context, queueMode, makeAnnotationProps()]); |
| 117 queueMode = cvox.QueueMode.QUEUE; | 115 queueMode = cvox.QueueMode.QUEUE; |
| 118 } | 116 } |
| 119 | 117 |
| 120 speakArgs.push([this.text, | 118 speakArgs.push( |
| 121 queueMode, | 119 [this.text, queueMode, this.personality ? this.personality : {}]); |
| 122 this.personality ? this.personality : {}]); | |
| 123 queueMode = cvox.QueueMode.QUEUE; | 120 queueMode = cvox.QueueMode.QUEUE; |
| 124 | 121 |
| 125 if (this.userValue) { | 122 if (this.userValue) { |
| 126 speakArgs.push([this.userValue, queueMode, {}]); | 123 speakArgs.push([this.userValue, queueMode, {}]); |
| 127 } | 124 } |
| 128 | 125 |
| 129 if (this.annotation) { | 126 if (this.annotation) { |
| 130 speakArgs.push([this.annotation, queueMode, makeAnnotationProps()]); | 127 speakArgs.push([this.annotation, queueMode, makeAnnotationProps()]); |
| 131 } | 128 } |
| 132 | 129 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 149 } | 146 } |
| 150 }; | 147 }; |
| 151 | 148 |
| 152 | 149 |
| 153 /** | 150 /** |
| 154 * Compares two NavDescriptions. | 151 * Compares two NavDescriptions. |
| 155 * @param {cvox.NavDescription} that A NavDescription. | 152 * @param {cvox.NavDescription} that A NavDescription. |
| 156 * @return {boolean} True if equal. | 153 * @return {boolean} True if equal. |
| 157 */ | 154 */ |
| 158 cvox.NavDescription.prototype.equals = function(that) { | 155 cvox.NavDescription.prototype.equals = function(that) { |
| 159 return this.context == that.context && | 156 return this.context == that.context && this.text == that.text && |
| 160 this.text == that.text && | 157 this.userValue == that.userValue && this.annotation == that.annotation; |
| 161 this.userValue == that.userValue && | |
| 162 this.annotation == that.annotation; | |
| 163 }; | 158 }; |
| OLD | NEW |