Chromium Code Reviews| Index: chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table.js |
| diff --git a/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table.js b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table.js |
| index e3689000ce96a61150003362d43ffa1f42bb2daa..b6534f321dccab0a355a0a4ab05fa4e7abfbddca 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table.js |
| @@ -29,10 +29,24 @@ cvox.BrailleTable.TABLE_PATH = 'chromevox/background/braille/tables.json'; |
| /** |
| + * @const {string} |
| + * @private |
| + */ |
| +cvox.BrailleTable.COMMON_DEFS_FILENAME_ = 'cvox-common.cti'; |
| + |
| + |
| +/** |
| * Retrieves a list of all available braille tables. |
| * @param {function(!Array.<cvox.BrailleTable.Table>)} callback |
| */ |
| cvox.BrailleTable.getAll = function(callback) { |
| + function fixFilenames(tables) { |
|
David Tseng
2014/09/22 17:53:05
Maybe appendCommonFile? (there's nothing wrong wit
|
| + // Append the common definitions to all table filenames. |
| + tables.forEach(function(table) { |
| + table.fileName += (',' + cvox.BrailleTable.COMMON_DEFS_FILENAME_); |
|
David Tseng
2014/09/22 17:53:05
Can we just load the common table once elsewhere r
|
| + }); |
| + return tables; |
| + } |
| var url = chrome.extension.getURL(cvox.BrailleTable.TABLE_PATH); |
| if (!url) { |
| throw 'Invalid path: ' + cvox.BrailleTable.TABLE_PATH; |
| @@ -43,8 +57,10 @@ cvox.BrailleTable.getAll = function(callback) { |
| xhr.onreadystatechange = function() { |
| if (xhr.readyState == 4) { |
| if (xhr.status == 200) { |
| - callback(/** @type {!Array.<cvox.BrailleTable.Table>} */ ( |
| - JSON.parse(xhr.responseText))); |
| + callback( |
| + fixFilenames( |
| + /** @type {!Array.<cvox.BrailleTable.Table>} */ ( |
| + JSON.parse(xhr.responseText)))); |
| } |
| } |
| }; |