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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(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 Sends Text-To-Speech commands to the TTS that is
7 * embedded in ChromeOS.
8 */
9
10 goog.provide('cvox.ChromeVoxChromeOsTtsEngine');
11
12 goog.require('cvox.AbstractTts');
13
14 /**
15 * @constructor
16 * @extends {cvox.AbstractTts}
17 */
18 cvox.ChromeVoxChromeOsTtsEngine = function() {
19 //Inherit AbstractTts
20 cvox.AbstractTts.call(this);
21 };
22 goog.inherits(cvox.ChromeVoxChromeOsTtsEngine, cvox.AbstractTts);
23
24 /**
25 * @return {string} The human-readable name of the speech engine.
26 */
27 cvox.ChromeVoxChromeOsTtsEngine.prototype.getName = function() {
28 return 'Chrome OS Native Speech';
29 };
30
31 /**
32 * Speaks the given string using the specified queueMode and properties.
33 * @param {string} textString The string of text to be spoken.
34 * @param {number=} queueMode The queue mode: AbstractTts.QUEUE_MODE_FLUSH
35 * for flush, AbstractTts.QUEUE_MODE_QUEUE for adding to queue.
36 * @param {Object=} properties Speech properties to use for this utterance.
37 */
38 cvox.ChromeVoxChromeOsTtsEngine.prototype.speak = function(
39 textString, queueMode, properties) {
40 cvox.ChromeVoxChromeOsTtsEngine.superClass_.speak.call(this, textString,
41 queueMode, properties);
42 if (queueMode === cvox.AbstractTts.QUEUE_MODE_FLUSH) {
43 this.stop();
44 }
45 var mergedProperties = this.mergeProperties(properties);
46 mergedProperties.enqueue = (queueMode === cvox.AbstractTts.QUEUE_MODE_QUEUE);
47 // chrome.experimental.tts.speak is a call directly into Chrome, so
48 // chrome.experimental.tts.speak(textString, null); is NOT the same as
49 // chrome.experimental.tts.speak(textString);
50 //
51 // TODO (chaitanyag): Make the underlying code handle var args so that
52 // properties can be optional and match JS expected behavior of these two
53 // being the same.
54 if (mergedProperties) {
55 chrome.experimental.tts.speak(textString, mergedProperties);
56 } else {
57 chrome.experimental.tts.speak(textString);
58 }
59 };
60
61 /**
62 * Returns true if the TTS is currently speaking.
63 * @return {boolean} True if the TTS is speaking.
64 */
65 cvox.ChromeVoxChromeOsTtsEngine.prototype.isSpeaking = function() {
66 cvox.ChromeVoxChromeOsTtsEngine.superClass_.isSpeaking.call(this);
67 return chrome.experimental.tts.isSpeaking();
68 };
69
70 /**
71 * Stops speech.
72 */
73 cvox.ChromeVoxChromeOsTtsEngine.prototype.stop = function() {
74 cvox.ChromeVoxChromeOsTtsEngine.superClass_.stop.call(this);
75 chrome.experimental.tts.stop();
76 };
77
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698