OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 Commands to pass from the ChromeVox background page context | |
7 * to the ChromeVox Panel. | |
8 */ | |
9 | |
10 goog.provide('PanelCommand'); | |
11 goog.provide('PanelCommandType'); | |
12 | |
13 /** | |
14 * Create one command to pass to the ChromeVox Panel. | |
15 * @param {PanelCommandType} type The type of command. | |
16 * @param {string|ArrayBuffer=} opt_data | |
17 * Optional data associated with the command. | |
18 * @constructor | |
19 */ | |
20 PanelCommand = function(type, opt_data) { | |
21 this.type = type; | |
22 this.data = opt_data; | |
23 }; | |
24 | |
25 /** | |
26 * Send this command to the ChromeVox Panel window. | |
27 */ | |
28 PanelCommand.prototype.send = function() { | |
29 var views = chrome.extension.getViews(); | |
30 for (var i = 0; i < views.length; i++) { | |
31 if (views[i].location.href.indexOf('background/panel.html') > 0) { | |
32 views[i].postMessage(JSON.stringify(this), window.location.origin); | |
33 } | |
34 } | |
35 }; | |
36 | |
37 /** | |
38 * Possible panel commands. | |
39 * @enum {string} | |
40 */ | |
41 PanelCommandType = { | |
42 CLEAR_SPEECH: 'clear_speech', | |
43 ADD_NORMAL_SPEECH: 'add_normal_speech', | |
44 ADD_ANNOTATION_SPEECH: 'add_annotation_speech', | |
45 UPDATE_BRAILLE_TEXT: 'update_braille_text', | |
46 UPDATE_BRAILLE_CELLS: 'update_braille_cells' | |
Peter Lundblad
2015/11/06 15:00:58
Since cells and text should always be updated toge
dmazzoni
2015/11/06 21:01:01
Done.
I already adjusted the CSS so that they lin
| |
47 }; | |
OLD | NEW |