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

Side by Side Diff: chrome/browser/resources/access_chromevox/chromevox/injected/tools/choice_widget.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 A floating choice widget that can be used as
7 * a replacement for the standard alert() popup, a disambiguation
8 * dialog if multiple targets are available, etc.
9 */
10
11 goog.provide('cvox.ChromeVoxChoiceWidget');
12
13 goog.require('cvox.AbstractEarcons');
14 goog.require('cvox.AbstractTts');
15 goog.require('cvox.ChromeVox');
16
17 /**
18 * @constructor
19 */
20 cvox.ChromeVoxChoiceWidget = function() {
21 this.powerKey = new PowerKey('main', null);
22 this.powerKey.createCompletionField(document.body, 50, null, null, null,
23 false);
24 this.powerKey.setAutoHideCompletionField(true);
25 this.powerKey.setDefaultCSSStyle();
26 };
27
28 /**
29 * Creates an alert dialog widget given a set of descriptions and associated
30 * functions.
31 *
32 * @param {Array.<string>} descriptions The array of strings to present
33 * to the user.
34 * @param {Array.<string>} functions The array of functions associated
35 * with the descriptions.
36 * @param {string} prompt The message to be spoken to the user.
37 */
38 cvox.ChromeVoxChoiceWidget.prototype.show = function(descriptions, functions,
39 prompt) {
40 this.powerKey.setCompletionList(descriptions);
41 var completionActionMap = new Object();
42 for (var i = 0, description; description = descriptions[i]; i++) {
43 var action = new Object();
44 action['main'] = functions[i];
45 completionActionMap[description.toLowerCase()] = action;
46 }
47 this.powerKey.setCompletionActionMap(completionActionMap);
48 this.powerKey.setCompletionPromptStr(descriptions.toString());
49 this.powerKey.setBrowseCallback(function(text) {
50 cvox.ChromeVox.tts.speak(text, cvox.AbstractTts.QUEUE_MODE_FLUSH,
51 null);
52 });
53 this.powerKey.updateCompletionField(PowerKey.status.VISIBLE, true, 40, 20);
54 cvox.ChromeVox.earcons.playEarcon(cvox.AbstractEarcons.LISTBOX);
55 window.setTimeout(function() {
56 cvox.ChromeVox.tts.speak(prompt);
57 }, 0);
58 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698