Chromium Code Reviews| 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|{text: string, braille: string}=} opt_data | |
|
Peter Lundblad
2015/11/10 10:46:36
Remove the ArrayBuffer. Not needed, and wouldn't b
dmazzoni
2015/11/10 17:33:17
Done.
| |
| 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: 'update_braille', | |
| 46 }; | |
| OLD | NEW |