Index: chrome/browser/resources/access_chromevox/audio/background/extension_tts_engine.js |
=================================================================== |
--- chrome/browser/resources/access_chromevox/audio/background/extension_tts_engine.js (revision 0) |
+++ chrome/browser/resources/access_chromevox/audio/background/extension_tts_engine.js (revision 0) |
@@ -0,0 +1,75 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+/** |
+ * @fileoverview Sends Text-To-Speech commands to a separate Chrome extension. |
+ */ |
+ |
+// Substituted by package.py |
+var ttsExtensionId = 'jhfhnnjfmmflacfniolmefnflomjcbdf'; |
+ |
+goog.provide('cvox.ChromeVoxExtensionTtsEngine'); |
+ |
+goog.require('cvox.AbstractTts'); |
+ |
+/** |
+ * @constructor |
+ * @extends {cvox.AbstractTts} |
+ */ |
+cvox.ChromeVoxExtensionTtsEngine = function() { |
+ //Inherit AbstractTts |
+ cvox.AbstractTts.call(this); |
+ |
+ this.ttsExtensionPort = chrome.extension.connect(ttsExtensionId); |
+}; |
+goog.inherits(cvox.ChromeVoxExtensionTtsEngine, cvox.AbstractTts); |
+ |
+/** |
+ * @return {string} The human-readable name of the speech engine. |
+ */ |
+cvox.ChromeVoxExtensionTtsEngine.prototype.getName = function() { |
+ return 'Native Client Pico Speech'; |
+}; |
+ |
+/** |
+ * Speaks the given string using the specified queueMode and properties. |
+ * @param {string} textString The string of text to be spoken. |
+ * @param {number=} queueMode The queue mode: AbstractTts.QUEUE_MODE_FLUSH |
+ * for flush, AbstractTts.QUEUE_MODE_QUEUE for adding to queue. |
+ * @param {Object=} properties Speech properties to use for this utterance. |
+ */ |
+cvox.ChromeVoxExtensionTtsEngine.prototype.speak = function( |
+ textString, queueMode, properties) { |
+ cvox.ChromeVoxExtensionTtsEngine.superClass_.speak.call(this, textString, |
+ queueMode, properties); |
+ // TODO: the TTS extension should handle queueMode directly. |
+ if (queueMode == cvox.AbstractTts.QUEUE_MODE_FLUSH) { |
+ this.stop(); |
+ } |
+ |
+ this.ttsExtensionPort.postMessage( |
+ {'action': 'speak', |
+ 'text': textString, |
+ 'queueMode': queueMode, |
+ 'properties': properties}); |
+}; |
+ |
+/** |
+ * Returns true if the TTS is currently speaking. |
+ * @return {boolean} True if the TTS is speaking. |
+ */ |
+cvox.ChromeVoxExtensionTtsEngine.prototype.isSpeaking = function() { |
+ cvox.ChromeVoxExtensionTtsEngine.superClass_.isSpeaking.call(this); |
+ // TODO: Fix this. |
+ return false; |
+}; |
+ |
+/** |
+ * Stops speech. |
+ */ |
+cvox.ChromeVoxExtensionTtsEngine.prototype.stop = function() { |
+ cvox.ChromeVoxExtensionTtsEngine.superClass_.stop.call(this); |
+ this.ttsExtensionPort.postMessage( |
+ {'action': 'stop'}); |
+}; |
Property changes on: chrome/browser/resources/access_chromevox/audio/background/extension_tts_engine.js |
___________________________________________________________________ |
Added: svn:executable |
+ * |
Added: svn:eol-style |
+ LF |