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

Unified Diff: chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js

Issue 6254007: Adding ChromeVox as a component extensions (enabled only for ChromeOS, for no... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js
===================================================================
--- chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js (revision 0)
+++ chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js (revision 0)
@@ -0,0 +1,77 @@
+// 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 the TTS that is
+ * embedded in ChromeOS.
+ */
+
+goog.provide('cvox.ChromeVoxChromeOsTtsEngine');
+
+goog.require('cvox.AbstractTts');
+
+/**
+ * @constructor
+ * @extends {cvox.AbstractTts}
+ */
+cvox.ChromeVoxChromeOsTtsEngine = function() {
+ //Inherit AbstractTts
+ cvox.AbstractTts.call(this);
+};
+goog.inherits(cvox.ChromeVoxChromeOsTtsEngine, cvox.AbstractTts);
+
+/**
+ * @return {string} The human-readable name of the speech engine.
+ */
+cvox.ChromeVoxChromeOsTtsEngine.prototype.getName = function() {
+ return 'Chrome OS Native 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.ChromeVoxChromeOsTtsEngine.prototype.speak = function(
+ textString, queueMode, properties) {
+ cvox.ChromeVoxChromeOsTtsEngine.superClass_.speak.call(this, textString,
+ queueMode, properties);
+ if (queueMode === cvox.AbstractTts.QUEUE_MODE_FLUSH) {
+ this.stop();
+ }
+ var mergedProperties = this.mergeProperties(properties);
+ mergedProperties.enqueue = (queueMode === cvox.AbstractTts.QUEUE_MODE_QUEUE);
+ // chrome.experimental.tts.speak is a call directly into Chrome, so
+ // chrome.experimental.tts.speak(textString, null); is NOT the same as
+ // chrome.experimental.tts.speak(textString);
+ //
+ // TODO (chaitanyag): Make the underlying code handle var args so that
+ // properties can be optional and match JS expected behavior of these two
+ // being the same.
+ if (mergedProperties) {
+ chrome.experimental.tts.speak(textString, mergedProperties);
+ } else {
+ chrome.experimental.tts.speak(textString);
+ }
+};
+
+/**
+ * Returns true if the TTS is currently speaking.
+ * @return {boolean} True if the TTS is speaking.
+ */
+cvox.ChromeVoxChromeOsTtsEngine.prototype.isSpeaking = function() {
+ cvox.ChromeVoxChromeOsTtsEngine.superClass_.isSpeaking.call(this);
+ return chrome.experimental.tts.isSpeaking();
+};
+
+/**
+ * Stops speech.
+ */
+cvox.ChromeVoxChromeOsTtsEngine.prototype.stop = function() {
+ cvox.ChromeVoxChromeOsTtsEngine.superClass_.stop.call(this);
+ chrome.experimental.tts.stop();
+};
+
Property changes on: chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698