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

Side by Side Diff: chrome/browser/resources/network_speech_synthesis/tts_extension.js

Issue 917093003: Shorten Closure template notation from Array.<*> to Array<*>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove cvox Created 5 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 6 * @fileoverview
7 * This is a component extension that implements a text-to-speech (TTS) 7 * This is a component extension that implements a text-to-speech (TTS)
8 * engine powered by Google's speech synthesis API. 8 * engine powered by Google's speech synthesis API.
9 * 9 *
10 * This is an "event page", so it's not loaded when the API isn't being used, 10 * This is an "event page", so it's not loaded when the API isn't being used,
(...skipping 20 matching lines...) Expand all
31 * @private 31 * @private
32 */ 32 */
33 SPEECH_SERVER_URL_: 33 SPEECH_SERVER_URL_:
34 'https://www.google.com/speech-api/v2/synthesize?' + 34 'https://www.google.com/speech-api/v2/synthesize?' +
35 'enc=mpeg&client=chromium', 35 'enc=mpeg&client=chromium',
36 36
37 /** 37 /**
38 * A mapping from language and gender to voice name, hardcoded for now 38 * A mapping from language and gender to voice name, hardcoded for now
39 * until the speech synthesis server capabilities response provides this. 39 * until the speech synthesis server capabilities response provides this.
40 * The key of this map is of the form '<lang>-<gender>'. 40 * The key of this map is of the form '<lang>-<gender>'.
41 * @type {Object.<string, string>} 41 * @type {Object<string, string>}
42 * @private 42 * @private
43 */ 43 */
44 LANG_AND_GENDER_TO_VOICE_NAME_: { 44 LANG_AND_GENDER_TO_VOICE_NAME_: {
45 'en-gb-male': 'rjs', 45 'en-gb-male': 'rjs',
46 'en-gb-female': 'fis', 46 'en-gb-female': 'fis',
47 }, 47 },
48 48
49 /** 49 /**
50 * The arguments passed to the onSpeak event handler for the utterance 50 * The arguments passed to the onSpeak event handler for the utterance
51 * that's currently being spoken. Should be null when no object is 51 * that's currently being spoken. Should be null when no object is
52 * pending. 52 * pending.
53 * 53 *
54 * @type {?{utterance: string, options: Object, callback: Function}} 54 * @type {?{utterance: string, options: Object, callback: Function}}
55 * @private 55 * @private
56 */ 56 */
57 currentUtterance_: null, 57 currentUtterance_: null,
58 58
59 /** 59 /**
60 * The HTML5 audio element we use for playing the sound served by the 60 * The HTML5 audio element we use for playing the sound served by the
61 * speech server. 61 * speech server.
62 * @type {HTMLAudioElement} 62 * @type {HTMLAudioElement}
63 * @private 63 * @private
64 */ 64 */
65 audioElement_: null, 65 audioElement_: null,
66 66
67 /** 67 /**
68 * A mapping from voice name to language and gender, derived from the 68 * A mapping from voice name to language and gender, derived from the
69 * manifest file. This is used in case the speech synthesis request 69 * manifest file. This is used in case the speech synthesis request
70 * specifies a voice name but doesn't specify a language code or gender. 70 * specifies a voice name but doesn't specify a language code or gender.
71 * @type {Object.<string, {lang: string, gender: string}>} 71 * @type {Object<string, {lang: string, gender: string}>}
72 * @private 72 * @private
73 */ 73 */
74 voiceNameToLangAndGender_: {}, 74 voiceNameToLangAndGender_: {},
75 75
76 /** 76 /**
77 * This is the main function called to initialize this extension. 77 * This is the main function called to initialize this extension.
78 * Initializes data structures and adds event listeners. 78 * Initializes data structures and adds event listeners.
79 */ 79 */
80 init: function() { 80 init: function() {
81 // Get voices from manifest. 81 // Get voices from manifest.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 */ 245 */
246 onResume_: function() { 246 onResume_: function() {
247 if (this.currentUtterance_) { 247 if (this.currentUtterance_) {
248 this.audioElement_.play(); 248 this.audioElement_.play();
249 } 249 }
250 } 250 }
251 251
252 }; 252 };
253 253
254 (new TtsExtension()).init(); 254 (new TtsExtension()).init();
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/dns_view.js ('k') | chrome/browser/resources/ntp4/most_visited_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698