OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview Bridge that sends TTS messages from content scripts or |
| 7 * other pages to the main background page. |
| 8 */ |
| 9 |
| 10 goog.provide('cvox.RemoteTtsManager'); |
| 11 |
| 12 goog.require('cvox.AbstractTts'); |
| 13 goog.require('cvox.AbstractTtsManager'); |
| 14 |
| 15 if (BUILD_TYPE == BUILD_TYPE_CHROME) { |
| 16 |
| 17 /** |
| 18 * @constructor |
| 19 * @extends {cvox.AbstractTtsManager} |
| 20 */ |
| 21 cvox.RemoteTtsManager = function() { |
| 22 cvox.AbstractTtsManager.call(this); |
| 23 }; |
| 24 goog.inherits(cvox.RemoteTtsManager, cvox.AbstractTtsManager); |
| 25 |
| 26 /** |
| 27 * @return {string} The human-readable name of this instance. |
| 28 */ |
| 29 cvox.RemoteTtsManager.prototype.getName = function() { |
| 30 return 'RemoteTtsManager'; |
| 31 }; |
| 32 |
| 33 /** |
| 34 * Speaks the given string using the specified queueMode and properties. |
| 35 * @param {string} textString The string of text to be spoken. |
| 36 * @param {number=} queueMode The queue mode: AbstractTts.QUEUE_MODE_FLUSH |
| 37 * for flush, AbstractTts.QUEUE_MODE_QUEUE for adding to queue. |
| 38 * @param {Object=} properties Speech properties to use for this utterance. |
| 39 */ |
| 40 cvox.RemoteTtsManager.prototype.speak = function(textString, queueMode, |
| 41 properties) { |
| 42 cvox.RemoteTtsManager.superClass_.speak.call(this, textString, queueMode, |
| 43 properties); |
| 44 cvox.ExtensionBridge.send( |
| 45 {'target': 'TTS', |
| 46 'action': 'speak', |
| 47 'text': textString, |
| 48 'queueMode': queueMode, |
| 49 'properties': properties}); |
| 50 }; |
| 51 |
| 52 /** |
| 53 * Returns true if the TTS is currently speaking. |
| 54 * @return {boolean} True if the TTS is speaking. |
| 55 */ |
| 56 cvox.RemoteTtsManager.prototype.isSpeaking = function() { |
| 57 cvox.RemoteTtsManager.superClass_.isSpeaking.call(this); |
| 58 return false; |
| 59 }; |
| 60 |
| 61 /** |
| 62 * Stops speech. |
| 63 */ |
| 64 cvox.RemoteTtsManager.prototype.stop = function() { |
| 65 cvox.RemoteTtsManager.superClass_.stop.call(this); |
| 66 cvox.ExtensionBridge.send( |
| 67 {'target': 'TTS', |
| 68 'action': 'stop'}); |
| 69 }; |
| 70 |
| 71 /** |
| 72 * Switch to the next TTS engine and optionally announce its name. |
| 73 * |
| 74 * @param {boolean} announce If true, will announce the name of the |
| 75 * new TTS engine. |
| 76 */ |
| 77 cvox.RemoteTtsManager.prototype.nextEngine = function(announce) { |
| 78 cvox.RemoteTtsManager.superClass_.nextTtsEngine.call(this, announce); |
| 79 cvox.ExtensionBridge.send( |
| 80 {'target': 'TTS', |
| 81 'action': 'nextEngine'}); |
| 82 }; |
| 83 |
| 84 /** |
| 85 * Decreases a TTS speech property. |
| 86 * @param {string} property_name The name of the property to decrease. |
| 87 */ |
| 88 cvox.RemoteTtsManager.prototype.decreaseProperty = function(property_name) { |
| 89 cvox.RemoteTtsManager.superClass_.decreaseProperty.call(this, |
| 90 property_name); |
| 91 cvox.ExtensionBridge.send( |
| 92 {'target': 'TTS', |
| 93 'action': 'decrease' + property_name }); |
| 94 }; |
| 95 |
| 96 /** |
| 97 * Increases a TTS speech property. |
| 98 * @param {string} property_name The name of the property to increase. |
| 99 */ |
| 100 cvox.RemoteTtsManager.prototype.increaseProperty = function(property_name) { |
| 101 cvox.RemoteTtsManager.superClass_.increaseProperty.call(this, |
| 102 property_name); |
| 103 cvox.ExtensionBridge.send( |
| 104 {'target': 'TTS', |
| 105 'action': 'increase' + property_name}); |
| 106 }; |
| 107 } else { |
| 108 cvox.RemoteTtsManager = function() {}; |
| 109 } |
OLD | NEW |