summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background')
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.html5
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js472
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js109
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/alert_modal.oggbin7046 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/alert_nonmodal.oggbin11433 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/button.oggbin7550 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/check_off.oggbin11421 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/check_on.oggbin10344 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/editable_text.oggbin5197 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/ellipsis.oggbin12631 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/invalid_keypress.oggbin5353 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/link.oggbin7508 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/list_item.oggbin5664 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/listbox.oggbin7396 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/long_desc.oggbin21030 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/math.oggbin5262 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_close.oggbin9753 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_enter.oggbin10748 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_exit.oggbin11619 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_open.oggbin9749 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_select.oggbin10572 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/page_finish_loading.oggbin13721 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/page_start_loading.oggbin11437 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/recover_focus.oggbin9546 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/selection.oggbin6323 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/selection_reverse.oggbin6263 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/skip.oggbin7146 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/wrap.oggbin9382 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/wrap_edge.oggbin5641 -> 0 bytes
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/externs.js67
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/injected_script_loader.js58
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer.html26
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer.js61
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer_loader.js13
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/classic_keymap.json5
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/flat_keymap.json5
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/key_map.js450
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json330
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/mathmaps/math_map.js188
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.html120
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js605
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options_loader.js10
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/prefs.js231
-rw-r--r--chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js152
44 files changed, 340 insertions, 2567 deletions
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.html b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.html
deleted file mode 100644
index ede68f23d92..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<script src="../../closure/base.js"></script>
-<script src="../../deps.js"></script>
-<script src="loader.js"></script>
-
-<script src="../../chromeVoxChromeBackgroundScript.js"></script>
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js
deleted file mode 100644
index 9393c4ad33b..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js
+++ /dev/null
@@ -1,472 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Script that runs on the background page.
- */
-
-goog.provide('cvox.ChromeVoxBackground');
-
-goog.require('Msgs');
-goog.require('cvox.AbstractEarcons');
-goog.require('cvox.BrailleBackground');
-goog.require('cvox.BrailleCaptionsBackground');
-goog.require('cvox.ChromeVox');
-goog.require('cvox.ChromeVoxEditableTextBase');
-goog.require('cvox.ChromeVoxPrefs');
-goog.require('cvox.CompositeTts');
-goog.require('cvox.ConsoleTts');
-goog.require('cvox.EarconsBackground');
-goog.require('cvox.ExtensionBridge');
-goog.require('cvox.HostFactory');
-goog.require('cvox.InjectedScriptLoader');
-goog.require('cvox.NavBraille');
-// TODO(dtseng): This is required to prevent Closure from stripping our export
-// prefs on window.
-goog.require('cvox.OptionsPage');
-goog.require('cvox.PlatformFilter');
-goog.require('cvox.PlatformUtil');
-goog.require('cvox.QueueMode');
-goog.require('cvox.TabsApiHandler');
-goog.require('cvox.TtsBackground');
-
-
-/**
- * This object manages the global and persistent state for ChromeVox.
- * It listens for messages from the content scripts on pages and
- * interprets them.
- * @constructor
- */
-cvox.ChromeVoxBackground = function() {
-};
-
-
-/**
- * Initialize the background page: set up TTS and bridge listeners.
- */
-cvox.ChromeVoxBackground.prototype.init = function() {
- // In the case of ChromeOS, only continue initialization if this instance of
- // ChromeVox is as we expect. This prevents ChromeVox from the webstore from
- // running.
- if (cvox.ChromeVox.isChromeOS &&
- chrome.i18n.getMessage('@@extension_id') !=
- 'mndnfokpggljbaajbnioimlmbfngpief') {
- return;
- }
-
- this.prefs = new cvox.ChromeVoxPrefs();
- this.readPrefs();
-
- var consoleTts = cvox.ConsoleTts.getInstance();
- consoleTts.setEnabled(true);
-
- /**
- * Chrome's actual TTS which knows and cares about pitch, volume, etc.
- * @type {cvox.TtsBackground}
- * @private
- */
- this.backgroundTts_ = new cvox.TtsBackground();
-
- /**
- * @type {cvox.TtsInterface}
- */
- this.tts = new cvox.CompositeTts()
- .add(this.backgroundTts_)
- .add(consoleTts);
-
- this.earcons = new cvox.EarconsBackground();
- this.addBridgeListener();
-
- /**
- * The actual Braille service.
- * @type {cvox.BrailleBackground}
- * @private
- */
- this.backgroundBraille_ = new cvox.BrailleBackground();
-
- this.tabsApiHandler_ = new cvox.TabsApiHandler(
- this.tts, this.backgroundBraille_, this.earcons);
-
- // Export globals on cvox.ChromeVox.
- cvox.ChromeVox.tts = this.tts;
- cvox.ChromeVox.braille = this.backgroundBraille_;
- cvox.ChromeVox.earcons = this.earcons;
-
- if (cvox.ChromeVox.isChromeOS &&
- chrome.accessibilityPrivate.onIntroduceChromeVox) {
- chrome.accessibilityPrivate.onIntroduceChromeVox.addListener(
- this.onIntroduceChromeVox);
- }
-
- // Set up a message passing system for goog.provide() calls from
- // within the content scripts.
- chrome.extension.onMessage.addListener(
- function(request, sender, callback) {
- if (request['srcFile']) {
- var srcFile = request['srcFile'];
- cvox.InjectedScriptLoader.fetchCode(
- [srcFile],
- function(code) {
- callback({'code': code[srcFile]});
- });
- }
- return true;
- });
-
- var self = this;
-
- // Inject the content script into all running tabs.
- chrome.windows.getAll({'populate': true}, function(windows) {
- for (var i = 0; i < windows.length; i++) {
- var tabs = windows[i].tabs;
- self.injectChromeVoxIntoTabs(tabs);
- }
- });
-
- if (localStorage['active'] == 'false') {
- // Warn the user when the browser first starts if ChromeVox is inactive.
- this.tts.speak(Msgs.getMsg('chromevox_inactive'),
- cvox.QueueMode.QUEUE);
- } else if (cvox.PlatformUtil.matchesPlatform(cvox.PlatformFilter.WML)) {
- // Introductory message.
- this.tts.speak(Msgs.getMsg('chromevox_intro'),
- cvox.QueueMode.QUEUE);
- cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(
- Msgs.getMsg('intro_brl')));
- }
-};
-
-
-/**
- * Inject ChromeVox into a tab.
- * @param {Array<Tab>} tabs The tab where ChromeVox scripts should be injected.
- */
-cvox.ChromeVoxBackground.prototype.injectChromeVoxIntoTabs = function(tabs) {
- var listOfFiles;
-
- // These lists of files must match the content_scripts section in
- // the manifest files.
- if (COMPILED) {
- listOfFiles = ['chromeVoxChromePageScript.js'];
- } else {
- listOfFiles = [
- 'closure/closure_preinit.js',
- 'closure/base.js',
- 'deps.js',
- 'chromevox/injected/loader.js'];
- }
-
- var stageTwo = function(code) {
- for (var i = 0, tab; tab = tabs[i]; i++) {
- window.console.log('Injecting into ' + tab.id, tab);
- var sawError = false;
-
- /**
- * A helper function which executes code.
- * @param {string} code The code to execute.
- */
- var executeScript = goog.bind(function(code) {
- chrome.tabs.executeScript(
- tab.id,
- {'code': code,
- 'allFrames': true},
- goog.bind(function() {
- if (!chrome.extension.lastError) {
- return;
- }
- if (sawError) {
- return;
- }
- sawError = true;
- console.error('Could not inject into tab', tab);
- this.tts.speak('Error starting ChromeVox for ' +
- tab.title + ', ' + tab.url, cvox.QueueMode.QUEUE);
- }, this));
- }, this);
-
- // There is a scenario where two copies of the content script can get
- // loaded into the same tab on browser startup - one automatically and one
- // because the background page injects the content script into every tab
- // on startup. To work around potential bugs resulting from this,
- // ChromeVox exports a global function called disableChromeVox() that can
- // be used here to disable any existing running instance before we inject
- // a new instance of the content script into this tab.
- //
- // It's harmless if there wasn't a copy of ChromeVox already running.
- //
- // Also, set some variables so that Closure deps work correctly and so
- // that ChromeVox knows not to announce feedback as if a page just loaded.
- executeScript('try { window.disableChromeVox(); } catch(e) { }\n' +
- 'window.INJECTED_AFTER_LOAD = true;\n' +
- 'window.CLOSURE_NO_DEPS = true\n');
-
- // Now inject the ChromeVox content script code into the tab.
- listOfFiles.forEach(function(file) { executeScript(code[file]); });
- }
- };
-
- // We use fetchCode instead of chrome.extensions.executeFile because
- // executeFile doesn't propagate the file name to the content script
- // which means that script is not visible in Dev Tools.
- cvox.InjectedScriptLoader.fetchCode(listOfFiles, stageTwo);
-};
-
-
-/**
- * Called when a TTS message is received from a page content script.
- * @param {Object} msg The TTS message.
- */
-cvox.ChromeVoxBackground.prototype.onTtsMessage = function(msg) {
- if (msg['action'] == 'speak') {
- this.tts.speak(msg['text'],
- /** cvox.QueueMode */msg['queueMode'],
- msg['properties']);
- } else if (msg['action'] == 'stop') {
- this.tts.stop();
- } else if (msg['action'] == 'increaseOrDecrease') {
- this.tts.increaseOrDecreaseProperty(msg['property'], msg['increase']);
- var property = msg['property'];
- var engine = this.backgroundTts_;
- var valueAsPercent = Math.round(
- this.backgroundTts_.propertyToPercentage(property) * 100);
- var announcement;
- switch (msg['property']) {
- case cvox.AbstractTts.RATE:
- announcement = Msgs.getMsg('announce_rate',
- [valueAsPercent]);
- break;
- case cvox.AbstractTts.PITCH:
- announcement = Msgs.getMsg('announce_pitch',
- [valueAsPercent]);
- break;
- case cvox.AbstractTts.VOLUME:
- announcement = Msgs.getMsg('announce_volume',
- [valueAsPercent]);
- break;
- }
- if (announcement) {
- this.tts.speak(announcement,
- cvox.QueueMode.FLUSH,
- cvox.AbstractTts.PERSONALITY_ANNOTATION);
- }
- } else if (msg['action'] == 'cyclePunctuationEcho') {
- this.tts.speak(Msgs.getMsg(
- this.backgroundTts_.cyclePunctuationEcho()),
- cvox.QueueMode.FLUSH);
- }
-};
-
-
-/**
- * Called when an earcon message is received from a page content script.
- * @param {Object} msg The earcon message.
- */
-cvox.ChromeVoxBackground.prototype.onEarconMessage = function(msg) {
- if (msg.action == 'play') {
- this.earcons.playEarcon(msg.earcon);
- }
-};
-
-
-/**
- * Listen for connections from our content script bridges, and dispatch the
- * messages to the proper destination.
- */
-cvox.ChromeVoxBackground.prototype.addBridgeListener = function() {
- cvox.ExtensionBridge.addMessageListener(goog.bind(function(msg, port) {
- var target = msg['target'];
- var action = msg['action'];
-
- switch (target) {
- case 'OpenTab':
- var destination = {url: msg['url']};
- chrome.tabs.create(destination);
- break;
- case 'KbExplorer':
- var explorerPage = {url: 'chromevox/background/kbexplorer.html'};
- chrome.tabs.create(explorerPage);
- break;
- case 'HelpDocs':
- var helpPage = {url: 'http://chromevox.com/tutorial/index.html'};
- chrome.tabs.create(helpPage);
- break;
- case 'Options':
- if (action == 'open') {
- var optionsPage = {url: 'chromevox/background/options.html'};
- chrome.tabs.create(optionsPage);
- }
- break;
- case 'Data':
- if (action == 'getHistory') {
- var results = {};
- chrome.history.search({text: '', maxResults: 25}, function(items) {
- items.forEach(function(item) {
- if (item.url) {
- results[item.url] = true;
- }
- });
- port.postMessage({
- 'history': results
- });
- });
- }
- break;
- case 'Prefs':
- if (action == 'getPrefs') {
- this.prefs.sendPrefsToPort(port);
- } else if (action == 'setPref') {
- if (msg['pref'] == 'active' &&
- msg['value'] != cvox.ChromeVox.isActive) {
- if (cvox.ChromeVox.isActive) {
- this.tts.speak(Msgs.getMsg('chromevox_inactive'),
- cvox.QueueMode.FLUSH);
- chrome.accessibilityPrivate.setNativeAccessibilityEnabled(
- true);
- } else {
- chrome.accessibilityPrivate.setNativeAccessibilityEnabled(
- false);
- }
- } else if (msg['pref'] == 'earcons') {
- this.earcons.enabled = msg['value'];
- } else if (msg['pref'] == 'sticky' && msg['announce']) {
- if (msg['value']) {
- this.tts.speak(Msgs.getMsg('sticky_mode_enabled'),
- cvox.QueueMode.QUEUE);
- } else {
- this.tts.speak(
- Msgs.getMsg('sticky_mode_disabled'),
- cvox.QueueMode.QUEUE);
- }
- } else if (msg['pref'] == 'typingEcho' && msg['announce']) {
- var announce = '';
- switch (msg['value']) {
- case cvox.TypingEcho.CHARACTER:
- announce = Msgs.getMsg('character_echo');
- break;
- case cvox.TypingEcho.WORD:
- announce = Msgs.getMsg('word_echo');
- break;
- case cvox.TypingEcho.CHARACTER_AND_WORD:
- announce = Msgs.getMsg('character_and_word_echo');
- break;
- case cvox.TypingEcho.NONE:
- announce = Msgs.getMsg('none_echo');
- break;
- default:
- break;
- }
- if (announce) {
- this.tts.speak(announce, cvox.QueueMode.QUEUE);
- }
- } else if (msg['pref'] == 'brailleCaptions') {
- cvox.BrailleCaptionsBackground.setActive(msg['value']);
- }
- this.prefs.setPref(msg['pref'], msg['value']);
- this.readPrefs();
- }
- break;
- case 'Math':
- // TODO (sorge): Put the change of styles etc. here!
- if (msg['action'] == 'getDomains') {
- port.postMessage({'message': 'DOMAINS_STYLES',
- 'domains': this.backgroundTts_.mathmap.allDomains,
- 'styles': this.backgroundTts_.mathmap.allStyles});
- }
- break;
- case 'TTS':
- if (msg['startCallbackId'] != undefined) {
- msg['properties']['startCallback'] = function(opt_cleanupOnly) {
- port.postMessage({'message': 'TTS_CALLBACK',
- 'cleanupOnly': opt_cleanupOnly,
- 'id': msg['startCallbackId']});
- };
- }
- if (msg['endCallbackId'] != undefined) {
- msg['properties']['endCallback'] = function(opt_cleanupOnly) {
- port.postMessage({'message': 'TTS_CALLBACK',
- 'cleanupOnly': opt_cleanupOnly,
- 'id': msg['endCallbackId']});
- };
- }
- try {
- this.onTtsMessage(msg);
- } catch (err) {
- console.log(err);
- }
- break;
- case 'EARCON':
- this.onEarconMessage(msg);
- break;
- case 'BRAILLE':
- try {
- this.backgroundBraille_.onBrailleMessage(msg);
- } catch (err) {
- console.log(err);
- }
- break;
- }
- }, this));
-};
-
-
-/**
- * Read and apply preferences that affect the background context.
- */
-cvox.ChromeVoxBackground.prototype.readPrefs = function() {
- var prefs = this.prefs.getPrefs();
- cvox.ChromeVoxEditableTextBase.useIBeamCursor =
- (prefs['useIBeamCursor'] == 'true');
- cvox.ChromeVox.isActive =
- (prefs['active'] == 'true' || cvox.ChromeVox.isChromeOS);
- cvox.ChromeVox.isStickyPrefOn = (prefs['sticky'] == 'true');
-};
-
-/**
- * Checks if we are currently in an incognito window.
- * @return {boolean} True if incognito or not within a tab context, false
- * otherwise.
- * @private
- */
-cvox.ChromeVoxBackground.prototype.isIncognito_ = function() {
- var incognito = false;
- chrome.tabs.getCurrent(function(tab) {
- // Tab is null if not called from a tab context. In that case, also consider
- // it incognito.
- incognito = tab ? tab.incognito : true;
- });
- return incognito;
-};
-
-
-/**
- * Handles the onIntroduceChromeVox event.
- */
-cvox.ChromeVoxBackground.prototype.onIntroduceChromeVox = function() {
- cvox.ChromeVox.tts.speak(Msgs.getMsg('chromevox_intro'),
- cvox.QueueMode.QUEUE,
- {doNotInterrupt: true});
- cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(
- Msgs.getMsg('intro_brl')));
-};
-
-
-// Create the background page object and export a function window['speak']
-// so that other background pages can access it. Also export the prefs object
-// for access by the options page.
-(function() {
- var background = new cvox.ChromeVoxBackground();
- background.init();
- window['speak'] = goog.bind(background.tts.speak, background.tts);
-
- // Export the prefs object for access by the options page.
- window['prefs'] = background.prefs;
-
- // Export the braille translator manager for access by the options page.
- window['braille_translator_manager'] =
- background.backgroundBraille_.getTranslatorManager();
-
- // Export injection for ChromeVox Next.
- cvox.ChromeVox.injectChromeVoxIntoTabs =
- background.injectChromeVoxIntoTabs.bind(background);
-})();
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js
deleted file mode 100644
index 2c7fa184355..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/** @fileoverview Sends braille content to a content script if the braille
- * captions feature is enabled.
- */
-
-goog.provide('cvox.BrailleCaptionsBackground');
-
-goog.require('cvox.BrailleDisplayState');
-goog.require('cvox.ExtensionBridge');
-
-/**
- * Key set in local storage when this feature is enabled.
- * @const
- */
-cvox.BrailleCaptionsBackground.PREF_KEY = 'brailleCaptions';
-
-
-/**
- * Unicode block of braille pattern characters. A braille pattern is formed
- * from this value with the low order 8 bits set to the bits representing
- * the dots as per the ISO 11548-1 standard.
- * @const
- */
-cvox.BrailleCaptionsBackground.BRAILLE_UNICODE_BLOCK_START = 0x2800;
-
-
-/**
- * Called once to initialize the class.
- * @param {function()} stateCallback Called when the state of the captions
- * feature changes.
- */
-cvox.BrailleCaptionsBackground.init = function(stateCallback) {
- var self = cvox.BrailleCaptionsBackground;
- /**
- * @type {function()}
- * @private
- */
- self.stateCallback_ = stateCallback;
-};
-
-
-/**
- * Returns whether the braille captions feature is enabled.
- * @return {boolean}
- */
-cvox.BrailleCaptionsBackground.isEnabled = function() {
- var self = cvox.BrailleCaptionsBackground;
- return localStorage[self.PREF_KEY] === String(true);
-};
-
-
-/**
- * @param {string} text Text of the shown braille.
- * @param {ArrayBuffer} cells Braille cells shown on the display.
- */
-cvox.BrailleCaptionsBackground.setContent = function(text, cells) {
- var self = cvox.BrailleCaptionsBackground;
- // Convert the cells to Unicode braille pattern characters.
- var byteBuf = new Uint8Array(cells);
- var brailleChars = '';
- for (var i = 0; i < byteBuf.length; ++i) {
- brailleChars += String.fromCharCode(
- self.BRAILLE_UNICODE_BLOCK_START | byteBuf[i]);
- }
- cvox.ExtensionBridge.send({
- message: 'BRAILLE_CAPTION',
- text: text,
- brailleChars: brailleChars
- });
-};
-
-
-/**
- * Sets whether the overlay should be active.
- * @param {boolean} newValue The new value of the active flag.
- */
-cvox.BrailleCaptionsBackground.setActive = function(newValue) {
- var self = cvox.BrailleCaptionsBackground;
- var oldValue = self.isEnabled();
- window['prefs'].setPref(self.PREF_KEY, String(newValue));
- if (oldValue != newValue) {
- if (self.stateCallback_) {
- self.stateCallback_();
- }
- var msg = newValue ?
- Msgs.getMsg('braille_captions_enabled') :
- Msgs.getMsg('braille_captions_disabled');
- cvox.ChromeVox.tts.speak(msg, cvox.QueueMode.QUEUE);
- cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(msg));
- }
-};
-
-
-/**
- * Returns a display state representing the state of the captions feature.
- * This is used when no actual hardware display is connected.
- * @return {cvox.BrailleDisplayState}
- */
-cvox.BrailleCaptionsBackground.getVirtualDisplayState = function() {
- var self = cvox.BrailleCaptionsBackground;
- if (self.isEnabled()) {
- return {available: true, textCellCount: 40}; // 40, why not?
- } else {
- return {available: false};
- }
-};
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/alert_modal.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/alert_modal.ogg
deleted file mode 100644
index 6eb0f67d08f..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/alert_modal.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/alert_nonmodal.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/alert_nonmodal.ogg
deleted file mode 100644
index baacacdc62a..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/alert_nonmodal.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/button.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/button.ogg
deleted file mode 100644
index f0d40878867..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/button.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/check_off.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/check_off.ogg
deleted file mode 100644
index 86f4fe9e4da..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/check_off.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/check_on.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/check_on.ogg
deleted file mode 100644
index 9c718d048b5..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/check_on.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/editable_text.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/editable_text.ogg
deleted file mode 100644
index 4e4ea3988a4..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/editable_text.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/ellipsis.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/ellipsis.ogg
deleted file mode 100644
index e4e4a2bc7b7..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/ellipsis.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/invalid_keypress.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/invalid_keypress.ogg
deleted file mode 100644
index 292cefdde6a..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/invalid_keypress.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/link.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/link.ogg
deleted file mode 100644
index 0615568ad09..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/link.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/list_item.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/list_item.ogg
deleted file mode 100644
index f810ab89ae5..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/list_item.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/listbox.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/listbox.ogg
deleted file mode 100644
index 8267c0d6fa6..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/listbox.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/long_desc.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/long_desc.ogg
deleted file mode 100644
index f4e62205349..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/long_desc.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/math.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/math.ogg
deleted file mode 100644
index da293f7b7ba..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/math.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_close.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_close.ogg
deleted file mode 100644
index 0ec85524c61..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_close.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_enter.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_enter.ogg
deleted file mode 100644
index cd7dedc286c..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_enter.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_exit.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_exit.ogg
deleted file mode 100644
index f203078c5f1..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_exit.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_open.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_open.ogg
deleted file mode 100644
index d0a324c3bb1..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_open.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_select.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_select.ogg
deleted file mode 100644
index b9fd70abceb..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/object_select.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/page_finish_loading.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/page_finish_loading.ogg
deleted file mode 100644
index 40bc918f1ed..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/page_finish_loading.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/page_start_loading.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/page_start_loading.ogg
deleted file mode 100644
index e53f0dc697d..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/page_start_loading.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/recover_focus.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/recover_focus.ogg
deleted file mode 100644
index 012fb57c7b5..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/recover_focus.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/selection.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/selection.ogg
deleted file mode 100644
index 95dde349b72..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/selection.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/selection_reverse.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/selection_reverse.ogg
deleted file mode 100644
index 8b04e73dc77..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/selection_reverse.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/skip.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/skip.ogg
deleted file mode 100644
index 708901a7b98..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/skip.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/wrap.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/wrap.ogg
deleted file mode 100644
index edff2552372..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/wrap.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/wrap_edge.ogg b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/wrap_edge.ogg
deleted file mode 100644
index e16ad7d94b9..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/earcons/wrap_edge.ogg
+++ /dev/null
Binary files differ
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/externs.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/externs.js
deleted file mode 100644
index 9b04b6d9bc9..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/externs.js
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Common external variables when compiling ChromeVox background code
-
-var localStorage = {};
-
-/**
- * @type {Object}
- */
-chrome.accessibilityPrivate = {};
-
-/**
- * @param {boolean} on
- */
-chrome.accessibilityPrivate.setAccessibilityEnabled = function(on) {};
-
-/**
- * @param {boolean} on
- */
-chrome.accessibilityPrivate.setNativeAccessibilityEnabled = function(on) {
-};
-
-/**
- * @param {number} tabId
- * @param {function(Array<!Object>)} callback
- */
-chrome.accessibilityPrivate.getAlertsForTab =
- function(tabId, callback) {};
-
-/**
- * @param {Array<{left: number, top: number, width: number, height: number}>}
- * rects The bounding rects to draw focus ring(s) around, in global
- * screen coordinates.
- */
-chrome.accessibilityPrivate.setFocusRing = function(rects) {
-};
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onWindowOpened;
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onWindowClosed;
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onMenuOpened;
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onMenuClosed;
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onControlFocused;
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onControlAction;
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onControlHover;
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onTextChanged;
-
-/** @type ChromeEvent */
-chrome.accessibilityPrivate.onChromeVoxLoadStateChanged;
-/** @type {function()} */
-chrome.accessibilityPrivate.onChromeVoxLoadStateChanged.destroy_;
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/injected_script_loader.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/injected_script_loader.js
deleted file mode 100644
index 1cb54c8760c..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/injected_script_loader.js
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Responsible for loading scripts into the inject context.
- */
-
-goog.provide('cvox.InjectedScriptLoader');
-
-
-
-
-/** @constructor */
-cvox.InjectedScriptLoader = function() { };
-
-
-/**
- * Loads a dictionary of file contents for Javascript files.
- * @param {Array<string>} files A list of file names.
- * @param {function(Object<string,string>)} done A function called when all
- * the files have been loaded. Called with the code map as the first
- * parameter.
- */
-cvox.InjectedScriptLoader.fetchCode = function(files, done) {
- var code = {};
- var waiting = files.length;
- var startTime = new Date();
- var loadScriptAsCode = function(src) {
- // Load the script by fetching its source and running 'eval' on it
- // directly, with a magic comment that makes Chrome treat it like it
- // loaded normally. Wait until it's fetched before loading the
- // next script.
- var xhr = new XMLHttpRequest();
- var url = chrome.extension.getURL(src) + '?' + new Date().getTime();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- var scriptText = xhr.responseText;
- // Add a magic comment to the bottom of the file so that
- // Chrome knows the name of the script in the JavaScript debugger.
- var debugSrc = src.replace('closure/../', '');
- // The 'chromevox' id is only used in the DevTools instead of a long
- // extension id.
- scriptText += '\n//# sourceURL= chrome-extension://chromevox/' +
- debugSrc + '\n';
- code[src] = scriptText;
- waiting--;
- if (waiting == 0) {
- done(code);
- }
- }
- };
- xhr.open('GET', url);
- xhr.send(null);
- };
-
- files.forEach(function(f) { loadScriptAsCode(f); });
-};
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer.html b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer.html
deleted file mode 100644
index 468828e6fb7..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE HTML>
-<!-- Copyright 2014 The Chromium Authors. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file. -->
-<html>
-<head>
-<title class="i18n" msg="kbexplorer_title">Chrome OS Keyboard Explorer</title>
-<style type="text/css">
-h2 {
- font-family:arial;
-}
-</style>
-<script type="text/javascript" src="../../closure/base.js"></script>
-<script type="text/javascript" src="../../deps.js"></script>
-<script type="text/javascript" src="kbexplorer_loader.js"></script>
-
-<script type="text/javascript" src="../../chromeVoxKbExplorerScript.js"></script>
-
-</head>
-<body>
- <h2 class="i18n" msgid="kbexplorer_title">ChromeOS Keyboard Explorer</h2>
- <p class="i18n" msgid="kbexplorer_instructions">
- Press any key to learn its name. Ctrl + W will close the keyboard explorer.
- </p>
-</body>
-</html>
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer.js
deleted file mode 100644
index 730f6e7517c..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Script for ChromeOS keyboard explorer.
- *
- */
-
-goog.provide('cvox.KbExplorer');
-
-goog.require('cvox.KeyUtil');
-
-
-/**
- * Class to manage the keyboard explorer.
- * @constructor
- */
-cvox.KbExplorer = function() { };
-
-
-/**
- * Initialize keyboard explorer.
- */
-cvox.KbExplorer.init = function() {
- document.addEventListener('keydown', cvox.KbExplorer.onKeyDown, false);
- document.addEventListener('keyup', cvox.KbExplorer.onKeyUp, false);
- document.addEventListener('keypress', cvox.KbExplorer.onKeyPress, false);
-};
-
-
-/**
- * Handles keydown events by speaking the human understandable name of the key.
- * @param {Event} evt key event.
- */
-cvox.KbExplorer.onKeyDown = function(evt) {
- chrome.extension.getBackgroundPage()['speak'](
- cvox.KeyUtil.getReadableNameForKeyCode(evt.keyCode), false, {});
- evt.preventDefault();
- evt.stopPropagation();
-};
-
-
-/**
- * Handles keyup events.
- * @param {Event} evt key event.
- */
-cvox.KbExplorer.onKeyUp = function(evt) {
- evt.preventDefault();
- evt.stopPropagation();
-};
-
-
-/**
- * Handles keypress events.
- * @param {Event} evt key event.
- */
-cvox.KbExplorer.onKeyPress = function(evt) {
- evt.preventDefault();
- evt.stopPropagation();
-};
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer_loader.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer_loader.js
deleted file mode 100644
index 8d67237b0a5..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/kbexplorer_loader.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Description of this file.
- */
-
-goog.require('cvox.KbExplorer');
-
-document.addEventListener('DOMContentLoaded', function() {
- cvox.KbExplorer.init();
-}, false);
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/classic_keymap.json b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/classic_keymap.json
index 23afe78f75c..1aec5313c7f 100644
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/classic_keymap.json
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/classic_keymap.json
@@ -190,6 +190,11 @@
"keys": {"keyCode": [65, 65]}
}},
+ {"command": "toggleChromeVoxVersion",
+ "sequence": {"cvoxModifier": true,
+ "keys": {"keyCode": [81, 81]}
+ }},
+
{"command": "readCurrentTitle",
"sequence": {"cvoxModifier": true,
"keys": {"keyCode": [67, 84]}
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/flat_keymap.json b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/flat_keymap.json
index a6cee02895e..bde46804d9a 100644
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/flat_keymap.json
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/flat_keymap.json
@@ -604,6 +604,11 @@
"keys": {"keyCode": [115]}
}},
+ {"command": "toggleChromeVoxVersion",
+ "sequence": {"cvoxModifier": true,
+ "keys": {"keyCode": [81, 81]}
+ }},
+
{"command": "enableConsoleTts",
"sequence": {"cvoxModifier": true,
"keys": {"keyCode": [68, 67]}
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/key_map.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/key_map.js
deleted file mode 100644
index c3833eca7bc..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/key_map.js
+++ /dev/null
@@ -1,450 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-
-/**
- * @fileoverview This class provides a stable interface for initializing,
- * querying, and modifying a ChromeVox key map.
- *
- * An instance contains an object-based bi-directional mapping from key binding
- * to a function name of a user command (herein simply called a command).
- * A caller is responsible for providing a JSON keymap (a simple Object key
- * value structure), which has (key, command) key value pairs.
- *
- * Due to execution of user commands within the content script, the function
- * name of the command is not explicitly checked within the background page via
- * Closure. Any errors would only be caught at runtime.
- *
- * To retrieve static data about user commands, see both cvox.CommandStore and
- * cvox.UserCommands.
- */
-
-goog.provide('cvox.KeyMap');
-
-// TODO(dtseng): Only needed for sticky mode.
-goog.require('cvox.KeyUtil');
-goog.require('cvox.PlatformUtil');
-
-/**
- * @param {Array<Object<{command: string, sequence: cvox.KeySequence}>>}
- * commandsAndKeySequences An array of pairs - KeySequences and commands.
- * @constructor
- */
-cvox.KeyMap = function(commandsAndKeySequences) {
- /**
- * An array of bindings - commands and KeySequences.
- * @type {Array<Object<{command: string, sequence: cvox.KeySequence}>>}
- * @private
- */
- this.bindings_ = commandsAndKeySequences;
-
- /**
- * Maps a command to a key. This optimizes the process of searching for a
- * key sequence when you already know the command.
- * @type {Object<cvox.KeySequence>}
- * @private
- */
- this.commandToKey_ = {};
- this.buildCommandToKey_();
-};
-
-
-/**
- * Path to dir containing ChromeVox keymap json definitions.
- * @type {string}
- * @const
- */
-cvox.KeyMap.KEYMAP_PATH = 'chromevox/background/keymaps/';
-
-
-/**
- * An array of available key maps sorted by priority.
- * (The first map is the default, the last is the least important).
- * TODO(dtseng): Not really sure this belongs here, but it doesn't seem to be
- * user configurable, so it doesn't make sense to json-stringify it.
- * Should have class to siwtch among and manage multiple key maps.
- * @type {Object<Object<string>>}
- * @const
- */
-cvox.KeyMap.AVAILABLE_MAP_INFO = {
-'keymap_classic': {
- 'file': 'classic_keymap.json'
- },
-'keymap_flat': {
- 'file': 'flat_keymap.json'
- },
-'keymap_experimental': {
- 'file': 'experimental.json'
- }
-};
-
-
-/**
- * The index of the default key map info in cvox.KeyMap.AVAIABLE_KEYMAP_INFO.
- * @type {number}
- * @const
- */
-cvox.KeyMap.DEFAULT_KEYMAP = 0;
-
-
-/**
- * The number of mappings in the keymap.
- * @return {number} The number of mappings.
- */
-cvox.KeyMap.prototype.length = function() {
- return this.bindings_.length;
-};
-
-
-/**
- * Returns a copy of all KeySequences in this map.
- * @return {Array<cvox.KeySequence>} Array of all keys.
- */
-cvox.KeyMap.prototype.keys = function() {
- return this.bindings_.map(function(binding) {
- return binding.sequence;
- });
-};
-
-
-/**
- * Returns a collection of command, KeySequence bindings.
- * @return {Array<Object<cvox.KeySequence>>} Array of all command, key bindings.
- * @suppress {checkTypes} inconsistent return type
- * found : (Array<(Object<{command: string,
- * sequence: (cvox.KeySequence|null)}>|null)>|null)
- * required: (Array<(Object<(cvox.KeySequence|null)>|null)>|null)
- */
-cvox.KeyMap.prototype.bindings = function() {
- return this.bindings_;
-};
-
-
-/**
- * This method is called when cvox.KeyMap instances are stringified via
- * JSON.stringify.
- * @return {string} The JSON representation of this instance.
- */
-cvox.KeyMap.prototype.toJSON = function() {
- return JSON.stringify({bindings: this.bindings_});
-};
-
-
-/**
- * Writes to local storage.
- */
-cvox.KeyMap.prototype.toLocalStorage = function() {
- localStorage['keyBindings'] = this.toJSON();
-};
-
-
-/**
- * Checks if this key map has a given binding.
- * @param {string} command The command.
- * @param {cvox.KeySequence} sequence The key sequence.
- * @return {boolean} Whether the binding exists.
- */
-cvox.KeyMap.prototype.hasBinding = function(command, sequence) {
- if (this.commandToKey_ != null) {
- return this.commandToKey_[command] == sequence;
- } else {
- for (var i = 0; i < this.bindings_.length; i++) {
- var binding = this.bindings_[i];
- if (binding.command == command && binding.sequence == sequence) {
- return true;
- }
- }
- }
- return false;
-};
-
-
-/**
- * Checks if this key map has a given command.
- * @param {string} command The command to check.
- * @return {boolean} Whether 'command' has a binding.
- */
-cvox.KeyMap.prototype.hasCommand = function(command) {
- if (this.commandToKey_ != null) {
- return this.commandToKey_[command] != undefined;
- } else {
- for (var i = 0; i < this.bindings_.length; i++) {
- var binding = this.bindings_[i];
- if (binding.command == command) {
- return true;
- }
- }
- }
- return false;
-};
-
-
-/**
- * Checks if this key map has a given key.
- * @param {cvox.KeySequence} key The key to check.
- * @return {boolean} Whether 'key' has a binding.
- */
-cvox.KeyMap.prototype.hasKey = function(key) {
- for (var i = 0; i < this.bindings_.length; i++) {
- var binding = this.bindings_[i];
- if (binding.sequence.equals(key)) {
- return true;
- }
- }
- return false;
-};
-
-
-/**
- * Gets a command given a key.
- * @param {cvox.KeySequence} key The key to query.
- * @return {?string} The command, if any.
- */
-cvox.KeyMap.prototype.commandForKey = function(key) {
- if (key != null) {
- for (var i = 0; i < this.bindings_.length; i++) {
- var binding = this.bindings_[i];
- if (binding.sequence.equals(key)) {
- return binding.command;
- }
- }
- }
- return null;
-};
-
-
-/**
- * Gets a key given a command.
- * @param {string} command The command to query.
- * @return {!Array<cvox.KeySequence>} The keys associated with that command,
- * if any.
- */
-cvox.KeyMap.prototype.keyForCommand = function(command) {
- if (this.commandToKey_ != null) {
- return [this.commandToKey_[command]];
- } else {
- var keySequenceArray = [];
- for (var i = 0; i < this.bindings_.length; i++) {
- var binding = this.bindings_[i];
- if (binding.command == command) {
- keySequenceArray.push(binding.sequence);
- }
- }
- }
- return (keySequenceArray.length > 0) ? keySequenceArray : [];
-};
-
-
-/**
- * Merges an input map with this one. The merge preserves this instance's
- * mappings. It only adds new bindings if there isn't one already.
- * If either the incoming binding's command or key exist in this, it will be
- * ignored.
- * @param {!cvox.KeyMap} inputMap The map to merge with this.
- * @return {boolean} True if there were no merge conflicts.
- */
-cvox.KeyMap.prototype.merge = function(inputMap) {
- var keys = inputMap.keys();
- var cleanMerge = true;
- for (var i = 0; i < keys.length; ++i) {
- var key = keys[i];
- var command = inputMap.commandForKey(key);
- if (command == 'toggleStickyMode') {
- // TODO(dtseng): More uglyness because of sticky key.
- continue;
- } else if (key && command &&
- !this.hasKey(key) && !this.hasCommand(command)) {
- this.bind_(command, key);
- } else {
- cleanMerge = false;
- }
- }
- return cleanMerge;
-};
-
-
-/**
- * Changes an existing key binding to a new key. If the key is already bound to
- * a command, the rebind will fail.
- * @param {string} command The command to set.
- * @param {cvox.KeySequence} newKey The new key to assign it to.
- * @return {boolean} Whether the rebinding succeeds.
- */
-cvox.KeyMap.prototype.rebind = function(command, newKey) {
- if (this.hasCommand(command) && !this.hasKey(newKey)) {
- this.bind_(command, newKey);
- return true;
- }
- return false;
-};
-
-
-/**
- * Changes a key binding. Any existing bindings to the given key will be
- * deleted. Use this.rebind to have non-overwrite behavior.
- * @param {string} command The command to set.
- * @param {cvox.KeySequence} newKey The new key to assign it to.
- * @private
- */
-cvox.KeyMap.prototype.bind_ = function(command, newKey) {
- // TODO(dtseng): Need unit test to ensure command is valid for every *.json
- // keymap.
- var bound = false;
- for (var i = 0; i < this.bindings_.length; i++) {
- var binding = this.bindings_[i];
- if (binding.command == command) {
- // Replace the key with the new key.
- delete binding.sequence;
- binding.sequence = newKey;
- if (this.commandToKey_ != null) {
- this.commandToKey_[binding.command] = newKey;
- }
- bound = true;
- }
- }
- if (!bound) {
- var binding = {
- 'command': command,
- 'sequence': newKey
- };
- this.bindings_.push(binding);
- this.commandToKey_[binding.command] = binding.sequence;
- }
-};
-
-
-// TODO(dtseng): Move to a manager class.
-/**
- * Convenience method for getting a default key map.
- * @return {!cvox.KeyMap} The default key map.
- */
-cvox.KeyMap.fromDefaults = function() {
- return /** @type {!cvox.KeyMap} */ (
- cvox.KeyMap.fromPath(cvox.KeyMap.KEYMAP_PATH +
- cvox.KeyMap.AVAILABLE_MAP_INFO['keymap_classic'].file));
-};
-
-
-/**
- * Convenience method for creating a key map based on a JSON (key, value) Object
- * where the key is a literal keyboard string and value is a command string.
- * @param {string} json The JSON.
- * @return {cvox.KeyMap} The resulting object; null if unable to parse.
- */
-cvox.KeyMap.fromJSON = function(json) {
- try {
- var commandsAndKeySequences =
- /** @type {Array<Object<{command: string,
- * sequence: cvox.KeySequence}>>} */
- (JSON.parse(json).bindings);
- commandsAndKeySequences = commandsAndKeySequences.filter(function(value) {
- return value.sequence.platformFilter === undefined ||
- cvox.PlatformUtil.matchesPlatform(value.sequence.platformFilter);
- });
- } catch (e) {
- return null;
- }
-
- // Validate the type of the commandsAndKeySequences array.
- if (typeof(commandsAndKeySequences) != 'object') {
- return null;
- }
- for (var i = 0; i < commandsAndKeySequences.length; i++) {
- if (commandsAndKeySequences[i].command == undefined ||
- commandsAndKeySequences[i].sequence == undefined) {
- return null;
- } else {
- commandsAndKeySequences[i].sequence = /** @type {cvox.KeySequence} */
- (cvox.KeySequence.deserialize(commandsAndKeySequences[i].sequence));
- }
- }
- return new cvox.KeyMap(commandsAndKeySequences);
-};
-
-
-/**
- * Convenience method for creating a map local storage.
- * @return {cvox.KeyMap} A map that reads from local storage.
- */
-cvox.KeyMap.fromLocalStorage = function() {
- if (localStorage['keyBindings']) {
- return cvox.KeyMap.fromJSON(localStorage['keyBindings']);
- }
- return null;
-};
-
-
-/**
- * Convenience method for creating a cvox.KeyMap based on a path.
- * Warning: you should only call this within a background page context.
- * @param {string} path A valid path of the form
- * chromevox/background/keymaps/*.json.
- * @return {cvox.KeyMap} A valid KeyMap object; null on error.
- */
-cvox.KeyMap.fromPath = function(path) {
- return cvox.KeyMap.fromJSON(cvox.KeyMap.readJSON_(path));
-};
-
-
-/**
- * Convenience method for getting a currently selected key map.
- * @return {!cvox.KeyMap} The currently selected key map.
- */
-cvox.KeyMap.fromCurrentKeyMap = function() {
- var map = localStorage['currentKeyMap'];
- if (map && cvox.KeyMap.AVAILABLE_MAP_INFO[map]) {
- return /** @type {!cvox.KeyMap} */ (cvox.KeyMap.fromPath(
- cvox.KeyMap.KEYMAP_PATH + cvox.KeyMap.AVAILABLE_MAP_INFO[map].file));
- } else {
- return cvox.KeyMap.fromDefaults();
- }
-};
-
-
-/**
- * Takes a path to a JSON file and returns a JSON Object.
- * @param {string} path Contains the path to a JSON file.
- * @return {string} JSON.
- * @private
- * @suppress {missingProperties}
- */
-cvox.KeyMap.readJSON_ = function(path) {
- var url = chrome.extension.getURL(path);
- if (!url) {
- throw 'Invalid path: ' + path;
- }
-
- var xhr = new XMLHttpRequest();
- xhr.open('GET', url, false);
- xhr.send();
- return xhr.responseText;
-};
-
-
-/**
- * Resets the default modifier keys.
- * TODO(dtseng): Move elsewhere when we figure out our localStorage story.
- */
-cvox.KeyMap.prototype.resetModifier = function() {
- localStorage['cvoxKey'] = cvox.ChromeVox.modKeyStr;
-};
-
-
-/**
- * Builds the map of commands to keys.
- * @private
- */
-cvox.KeyMap.prototype.buildCommandToKey_ = function() {
- // TODO (dtseng): What about more than one sequence mapped to the same
- // command?
- for (var i = 0; i < this.bindings_.length; i++) {
- var binding = this.bindings_[i];
- if (this.commandToKey_[binding.command] != undefined) {
- // There's at least two key sequences mapped to the same
- // command. continue.
- continue;
- }
- this.commandToKey_[binding.command] = binding.sequence;
- }
-};
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json
new file mode 100644
index 00000000000..8d0628c980f
--- /dev/null
+++ b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/keymaps/next_keymap.json
@@ -0,0 +1,330 @@
+{
+ "bindings": [
+ {
+ "command": "previousElement",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [37]
+ }
+ }
+ },
+ {
+ "command": "previousLine",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [38]
+ }
+ }
+ },
+ {
+ "command": "nextElement",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [39]
+ }
+ }
+ },
+ {
+ "command": "nextLine",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [40]
+ }
+ }
+ },
+ {
+ "command": "nextCharacter",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [39],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "previousCharacter",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [37],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextWord",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [39],
+ "ctrlKey": [true],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "previousWord",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [37],
+ "ctrlKey": [true],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextButton",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [66]
+ }
+ }
+ },
+ {
+ "command": "previousButton",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [66],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextCheckBox",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [88]
+ }
+ }
+ },
+ {
+ "command": "previousCheckBox",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [88],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextCombobox",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [67]
+ }
+ }
+ },
+ {
+ "command": "previousCombobox",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [67],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextEditText",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [69]
+ }
+ }
+ },
+ {
+ "command": "previousEditText",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [69],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextFormField",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [70]
+ }
+ }
+ },
+ {
+ "command": "previousFormField",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [70],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextHeading",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [72]
+ }
+ }
+ },
+ {
+ "command": "previousHeading",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [72],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextLink",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [76]
+ }
+ }
+ },
+ {
+ "command": "previousLink",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [76],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextTable",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [84]
+ }
+ }
+ },
+ {
+ "command": "previousTable",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [84],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "nextVisitedLink",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [86]
+ }
+ }
+ },
+ {
+ "command": "previousVisitedLink",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [86],
+ "shiftKey": [true]
+ }
+ }
+ },
+ {
+ "command": "goToEnd",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [39],
+ "ctrlKey": [true]
+ }
+ }
+ },
+ {
+ "command": "goToBeginning",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [37],
+ "ctrlKey": [true]
+ }
+ }
+ },
+ {
+ "command": "doDefault",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [32]
+ }
+ }
+ },
+ {
+ "command": "showContextMenu",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [32],
+ "shitKey": [true]
+ }
+ }
+ },
+ {
+ "command": "continuousRead",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [82]
+ }
+ }
+ },
+ {
+ "command": "toggleChromeVoxVersion",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [81],
+ "shitKey": [true]
+ }
+ }
+ },
+ {
+ "command": "toggleChromeVox",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [65, 65]
+ }
+ }
+ },
+ {
+ "command": "toggleStickyMode",
+ "sequence": {
+ "cvoxModifier": true,
+ "keys": {
+ "keyCode": [91]
+ },
+ "doubleTap": true
+ }
+ }
+ ]
+}
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/mathmaps/math_map.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/mathmaps/math_map.js
deleted file mode 100644
index 0fd5306671b..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/mathmaps/math_map.js
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview A class for loading and storing the maps for math atoms from
- * JSON files. The class (and entries) can then be used as via the
- * background page.
- */
-
-
-goog.provide('cvox.MathMap');
-
-goog.require('cvox.MathCompoundStore');
-goog.require('cvox.MathUtil');
-
-
-/**
- *
- * @constructor
- */
-cvox.MathMap = function() {
-
- /**
- * The compund store for symbol and function mappings.
- * @type {cvox.MathCompoundStore}
- */
- this.store = cvox.MathCompoundStore.getInstance();
- cvox.MathMap.parseFiles(
- cvox.MathMap.FUNCTIONS_FILES_.map(
- function(file) {
- return cvox.MathMap.FUNCTIONS_PATH_ + file;
- }))
- .forEach(goog.bind(this.store.addFunctionRules, this.store));
- cvox.MathMap.parseFiles(
- cvox.MathMap.SYMBOLS_FILES_.map(
- function(file) {
- return cvox.MathMap.SYMBOLS_PATH_ + file;
- }))
- .forEach(goog.bind(this.store.addSymbolRules, this.store));
-
- var cstrValues = this.store.getDynamicConstraintValues();
- /**
- * Array of domain names.
- * @type {Array<string>}
- */
- this.allDomains = cstrValues.domain;
-
- /**
- * Array of style names.
- * @type {Array<string>}
- */
- this.allStyles = cstrValues.style;
-};
-
-
-/**
- * Stringifies MathMap into JSON object.
- * @return {string} The stringified version of the mapping.
- */
-cvox.MathMap.prototype.stringify = function() {
- return JSON.stringify(this);
-};
-
-
-/**
- * Path to dir containing ChromeVox JSON definitions for math speak.
- * @type {string}
- * @const
- * @private
- */
-cvox.MathMap.MATHMAP_PATH_ = 'chromevox/background/mathmaps/';
-
-
-/**
- * Subpath to dir containing ChromeVox JSON definitions for symbols.
- * @type {string}
- * @const
- * @private
- */
-cvox.MathMap.SYMBOLS_PATH_ = cvox.MathMap.MATHMAP_PATH_ + 'symbols/';
-
-
-/**
- * Subpath to dir containing ChromeVox JSON definitions for functions.
- * @type {string}
- * @const
- * @private
- */
-cvox.MathMap.FUNCTIONS_PATH_ = cvox.MathMap.MATHMAP_PATH_ + 'functions/';
-
-
-/**
- * Array of JSON filenames containing symbol definitions for math speak.
- * @type {Array<string>}
- * @const
- * @private
- */
-cvox.MathMap.SYMBOLS_FILES_ = [
- // Greek
- 'greek-capital.json', 'greek-small.json', 'greek-scripts.json',
- 'greek-mathfonts.json', 'greek-symbols.json',
-
- // Hebrew
- 'hebrew_letters.json',
-
- // Latin
- 'latin-lower-double-accent.json', 'latin-lower-normal.json',
- 'latin-lower-phonetic.json', 'latin-lower-single-accent.json',
- 'latin-rest.json', 'latin-upper-double-accent.json',
- 'latin-upper-normal.json', 'latin-upper-single-accent.json',
- 'latin-mathfonts.json',
-
- // Math Symbols
- 'math_angles.json', 'math_arrows.json', 'math_characters.json',
- 'math_delimiters.json', 'math_digits.json', 'math_geometry.json',
- 'math_harpoons.json', 'math_non_characters.json', 'math_symbols.json',
- 'math_whitespace.json', 'other_stars.json'
-];
-
-
-/**
- * Array of JSON filenames containing symbol definitions for math speak.
- * @type {Array<string>}
- * @const
- * @private
- */
-cvox.MathMap.FUNCTIONS_FILES_ = [
- 'algebra.json', 'elementary.json', 'hyperbolic.json', 'trigonometry.json'
-];
-
-
-/**
- * Loads JSON for a given file name.
- * @param {string} file A valid filename.
- * @return {string} A string representing JSON array.
- */
-cvox.MathMap.loadFile = function(file) {
- try {
- return cvox.MathMap.readJSON_(file);
- } catch (x) {
- console.log('Unable to load file: ' + file + ', error: ' + x);
- }
-};
-
-
-/**
- * Loads a list of JSON files.
- * @param {Array<string>} files An array of valid filenames.
- * @return {Array<string>} A string representing JSON array.
- */
-cvox.MathMap.loadFiles = function(files) {
- return files.map(cvox.MathMap.loadFile);
-};
-
-
-/**
- * Creates an array of JSON objects from a list of files.
- * @param {Array<string>} files An array of filenames.
- * @return {Array<Object>} Array of JSON objects.
- */
-cvox.MathMap.parseFiles = function(files) {
- var strs = cvox.MathMap.loadFiles(files);
-
- return [].concat.apply([], strs.map(
- // Note: As JSON.parse does not expect the value index as the second
- // parameter, we wrap it.
- function(value) { return JSON.parse(value); }));
-};
-
-
-/**
- * Takes path to a JSON file and returns a JSON object.
- * @param {string} path Contains the path to a JSON file.
- * @return {string} JSON.
- * @private
- */
-cvox.MathMap.readJSON_ = function(path) {
- var url = chrome.extension.getURL(path);
- if (!url) {
- throw 'Invalid path: ' + path;
- }
-
- var xhr = new XMLHttpRequest();
- xhr.open('GET', url, false);
- xhr.send();
- return xhr.responseText;
-};
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.html b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.html
deleted file mode 100644
index 58d0e7c6ab1..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.html
+++ /dev/null
@@ -1,120 +0,0 @@
-<!-- Copyright 2014 The Chromium Authors. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file. -->
-<html>
-
-<head>
-<title class="i18n" msgid="options_page_title">ChromeVox Options</title>
-<link rel="stylesheet" type="text/css" href="chrome_shared2.css" />
-<link rel="stylesheet" type="text/css" href="options_widgets.css" />
-<link rel="stylesheet" type="text/css" href="options.css" />
-
-
-<script type="text/javascript" src="../../closure/base.js"></script>
-<script type="text/javascript" src="../../deps.js"></script>
-<script type="text/javascript" src="options_loader.js"></script>
-<script type="text/javascript" src="../../chromeVoxChromeOptionsScript.js">
-</script>
-</head>
-
-<html>
-
-<body>
-<div>
- <!-- The "with dev msgs" in the title helps when debugging problems with the message
- replacer. -->
- <h1 class="i18n" msgid="options_page_title">ChromeVox (with dev msgs)</h1>
- <p id="version"></p>
-
-
- <div class="option">
- <input id="useVerboseMode" type="checkbox" class="checkbox pref" name="useVerboseMode" />
- <label for="useVerboseMode" class="i18n" msgid="options_verbosity_verbose">
- Enable verbose descriptions.
- </label>
- </div>
-
- <div class="option">
- <input id="useIBeamCursor" type="checkbox" class="checkbox pref" name="useIBeamCursor" />
- <label for="useIBeamCursor" class="i18n" msgid="options_cursor_between_characters">
- Place cursor between characters when editing text (like Mac OS X).
- </label>
- </div>
-
- <div class="option">
- <input id="focusFollowsMouse" type="checkbox" class="checkbox pref" name="focusFollowsMouse" />
- <label for="focusFollowsMouse" class="i18n" msgid="options_mouse_focus_follows">
- Use the mouse to change focus.
- </label>
- </div>
-
- <div class="option">
- <input id="siteSpecificEnhancements" type="checkbox" class="checkbox pref" name="siteSpecificEnhancements" />
- <label for="siteSpecificEnhancements" class="i18n" msgid="options_site_specific_enhancements">
- Enhance specific sites (like Google Search).
- </label>
- </div>
-
- <h2 class="i18n" msgid="options_voices">Voices</h2>
- <p class="i18n description" msgid="options_voices_description" id="voices_description">
- Change the current voice by selecting an option from the list below.
- </p>
-
- <div>
- <select class="pref" id="voices" aria-labelledby="voices_description"></select>
- <br><br>
- </div>
-
-
- <h2 class="chromeos i18n" msgid="options_braille">Braille</h2>
- <div class="chromeos">
- <p class="i18n description" msgid="options_braille_description_6" id="braille_description_6">
- Change the current 6 dot braille table by selecting an option from the list below.
- </p>
- <select class="pref" id="brailleTable6" aria-labelledby="braille_description_6"></select>
- <p class="i18n description" msgid="options_braille_description_8" id="braille_description_8">
- Change the current 8 dot braille table by selecting an option from the list below.
- </p>
- <select class="pref" id="brailleTable8" aria-labelledby="braille_description_8"></select>
- <button id="brailleTableType"></button>
- <div class="option">
- <label>
- <input id="brailleWordWrap" type="checkbox" class="checkbox pref" name="brailleWordWrap" />
- <span class="i18n" msgid="options_braille_word_wrap">
- Enable word wrap
- </span>
- </label>
- </div>
-
- <br><br>
- </div>
-
-
- <h2 class="i18n" msgid="options_keyboard_shortcuts">Keyboard shortcuts</h2>
- <p class="i18n description" msgid="options_keymap_description" id="keymap_description">
- Change the current keymap by selecting an option from the list below.
- </p>
-
- <div>
- <select class="pref" id="cvox_keymaps" aria-labelledby="keymap_description">
- </select>
- <button id="selectKeys" class="i18n" msgid="options_select_keys">
- Select keymap
- </button>
- <br><br>
- </div>
-
- <p class="i18n description" msgid="options_shortcuts_description"
- id="shortcuts_description">
- Customize keyboard shortcuts for frequently used commands by typing them into the
- corresponding fields below.
- </p>
-
- <div id="keysContainer">
-
- </div>
- <div id="status" role="live" aria-live="assertive">
- </div>
-</div>
-</body>
-</html>
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
deleted file mode 100644
index ed6dc727493..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
+++ /dev/null
@@ -1,605 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview ChromeVox options page.
- *
- */
-
-goog.provide('cvox.OptionsPage');
-
-goog.require('Msgs');
-goog.require('cvox.BrailleTable');
-goog.require('cvox.BrailleTranslatorManager');
-goog.require('cvox.ChromeEarcons');
-goog.require('cvox.ChromeHost');
-goog.require('cvox.ChromeTts');
-goog.require('cvox.ChromeVox');
-goog.require('cvox.ChromeVoxPrefs');
-goog.require('cvox.CommandStore');
-goog.require('cvox.ExtensionBridge');
-goog.require('cvox.HostFactory');
-goog.require('cvox.KeyMap');
-goog.require('cvox.KeySequence');
-goog.require('cvox.PlatformFilter');
-goog.require('cvox.PlatformUtil');
-
-/**
- * Class to manage the options page.
- * @constructor
- */
-cvox.OptionsPage = function() {
-};
-
-/**
- * The ChromeVoxPrefs object.
- * @type {cvox.ChromeVoxPrefs}
- */
-cvox.OptionsPage.prefs;
-
-
-/**
- * A mapping from keycodes to their human readable text equivalents.
- * This is initialized in cvox.OptionsPage.init for internationalization.
- * @type {Object<string>}
- */
-cvox.OptionsPage.KEYCODE_TO_TEXT = {
-};
-
-/**
- * A mapping from human readable text to keycode values.
- * This is initialized in cvox.OptionsPage.init for internationalization.
- * @type {Object<string>}
- */
-cvox.OptionsPage.TEXT_TO_KEYCODE = {
-};
-
-/**
- * Initialize the options page by setting the current value of all prefs,
- * building the key bindings table, and adding event listeners.
- * @suppress {missingProperties} Property prefs never defined on Window
- */
-cvox.OptionsPage.init = function() {
- cvox.OptionsPage.prefs = chrome.extension.getBackgroundPage().prefs;
- cvox.OptionsPage.populateKeyMapSelect();
- cvox.OptionsPage.addKeys();
- cvox.OptionsPage.populateVoicesSelect();
- cvox.BrailleTable.getAll(function(tables) {
- /** @type {!Array<cvox.BrailleTable.Table>} */
- cvox.OptionsPage.brailleTables = tables;
- cvox.OptionsPage.populateBrailleTablesSelect();
- });
- chrome.storage.local.get({'brailleWordWrap': true}, function(items) {
- $('brailleWordWrap').checked = items.brailleWordWrap;
- });
-
- Msgs.addTranslatedMessagesToDom(document);
- cvox.OptionsPage.hidePlatformSpecifics();
-
- cvox.OptionsPage.update();
-
- document.addEventListener('change', cvox.OptionsPage.eventListener, false);
- document.addEventListener('click', cvox.OptionsPage.eventListener, false);
- document.addEventListener('keydown', cvox.OptionsPage.eventListener, false);
-
- cvox.ExtensionBridge.addMessageListener(function(message) {
- if (message['keyBindings'] || message['prefs']) {
- cvox.OptionsPage.update();
- }
- });
-
- $('selectKeys').addEventListener(
- 'click', cvox.OptionsPage.reset, false);
-
- if (cvox.PlatformUtil.matchesPlatform(cvox.PlatformFilter.WML)) {
- $('version').textContent =
- chrome.app.getDetails().version;
- }
-
- // Temporary secret way to enable ChromeVox Next for the current run of
- // ChromeVox.
- var next = 'next';
- document.body.addEventListener('keypress', function(evt) {
- if (next === undefined) {
- return;
- }
- var key = String.fromCharCode(evt.charCode);
- if (next[0] === key) {
- next = next.slice(1);
-
- if (next === '') {
- cvox.OptionsPage.speak(
- 'You are now running ChromeVox Next; open a new tab to start',
- cvox.QueueMode.FLUSH);
- next = undefined;
- chrome.extension.getBackgroundPage()['global']
- .backgroundObj.forceChromeVoxNextActive();
- }
- } else {
- next = 'next';
- }
- return true;
- }, true);
-};
-
-/**
- * Update the value of controls to match the current preferences.
- * This happens if the user presses a key in a tab that changes a
- * pref.
- */
-cvox.OptionsPage.update = function() {
- var prefs = cvox.OptionsPage.prefs.getPrefs();
- for (var key in prefs) {
- // TODO(rshearer): 'active' is a pref, but there's no place in the
- // options page to specify whether you want ChromeVox active.
- var elements = document.querySelectorAll('*[name="' + key + '"]');
- for (var i = 0; i < elements.length; i++) {
- cvox.OptionsPage.setValue(elements[i], prefs[key]);
- }
- }
-};
-
-/**
- * Populate the keymap select element with stored keymaps
- */
-cvox.OptionsPage.populateKeyMapSelect = function() {
- var select = $('cvox_keymaps');
- for (var id in cvox.KeyMap.AVAILABLE_MAP_INFO) {
- var info = cvox.KeyMap.AVAILABLE_MAP_INFO[id];
- var option = document.createElement('option');
- option.id = id;
- option.className = 'i18n';
- option.setAttribute('msgid', id);
- if (cvox.OptionsPage.prefs.getPrefs()['currentKeyMap'] == id) {
- option.setAttribute('selected', '');
- }
- select.appendChild(option);
- }
-
- select.addEventListener('change', cvox.OptionsPage.reset, true);
-};
-
-/**
- * Add the input elements for the key bindings to the container element
- * in the page. They're sorted in order of description.
- */
-cvox.OptionsPage.addKeys = function() {
- var container = $('keysContainer');
- var keyMap = cvox.OptionsPage.prefs.getKeyMap();
-
- cvox.OptionsPage.prevTime = new Date().getTime();
- cvox.OptionsPage.keyCount = 0;
- container.addEventListener('keypress', goog.bind(function(evt) {
- if (evt.target.id == 'cvoxKey') {
- return;
- }
- this.keyCount++;
- var currentTime = new Date().getTime();
- if (currentTime - this.prevTime > 1000 || this.keyCount > 2) {
- if (document.activeElement.id == 'toggleKeyPrefix') {
- this.keySequence = new cvox.KeySequence(evt, false);
- this.keySequence.keys['ctrlKey'][0] = true;
- } else {
- this.keySequence = new cvox.KeySequence(evt, true);
- }
-
- this.keyCount = 1;
- } else {
- this.keySequence.addKeyEvent(evt);
- }
-
- var keySeqStr = cvox.KeyUtil.keySequenceToString(this.keySequence, true);
- var announce = keySeqStr.replace(/\+/g,
- ' ' + Msgs.getMsg('then') + ' ');
- announce = announce.replace(/>/g,
- ' ' + Msgs.getMsg('followed_by') + ' ');
- announce = announce.replace('Cvox',
- ' ' + Msgs.getMsg('modifier_key') + ' ');
-
- // TODO(dtseng): Only basic conflict detection; it does not speak the
- // conflicting command. Nor does it detect prefix conflicts like Cvox+L vs
- // Cvox+L>L.
- if (cvox.OptionsPage.prefs.setKey(document.activeElement.id,
- this.keySequence)) {
- document.activeElement.value = keySeqStr;
- } else {
- announce = Msgs.getMsg('key_conflict', [announce]);
- }
- cvox.OptionsPage.speak(announce, cvox.QueueMode.QUEUE);
- this.prevTime = currentTime;
-
- evt.preventDefault();
- evt.stopPropagation();
- }, cvox.OptionsPage), true);
-
- var categories = cvox.CommandStore.categories();
- for (var i = 0; i < categories.length; i++) {
- // Braille bindings can't be customized, so don't include them.
- if (categories[i] == 'braille') {
- continue;
- }
- var headerElement = document.createElement('h3');
- headerElement.className = 'i18n';
- headerElement.setAttribute('msgid', categories[i]);
- headerElement.id = categories[i];
- container.appendChild(headerElement);
- var commands = cvox.CommandStore.commandsForCategory(categories[i]);
- for (var j = 0; j < commands.length; j++) {
- var command = commands[j];
- // TODO: Someday we may want to have more than one key
- // mapped to a command, so we'll need to figure out how to display
- // that. For now, just take the first key.
- var keySeqObj = keyMap.keyForCommand(command)[0];
-
- // Explicitly skip toggleChromeVox in ChromeOS.
- if (command == 'toggleChromeVox' &&
- cvox.PlatformUtil.matchesPlatform(cvox.PlatformFilter.CHROMEOS)) {
- continue;
- }
-
- var inputElement = document.createElement('input');
- inputElement.type = 'text';
- inputElement.className = 'key active-key';
- inputElement.id = command;
-
- var displayedCombo;
- if (keySeqObj != null) {
- displayedCombo = cvox.KeyUtil.keySequenceToString(keySeqObj, true);
- } else {
- displayedCombo = '';
- }
- inputElement.value = displayedCombo;
-
- // Don't allow the user to change the sticky mode or stop speaking key.
- if (command == 'toggleStickyMode' || command == 'stopSpeech') {
- inputElement.disabled = true;
- }
- var message = cvox.CommandStore.messageForCommand(command);
- if (!message) {
- // TODO(dtseng): missing message id's.
- message = command;
- }
-
- var labelElement = document.createElement('label');
- labelElement.className = 'i18n';
- labelElement.setAttribute('msgid', message);
- labelElement.setAttribute('for', inputElement.id);
-
- var divElement = document.createElement('div');
- divElement.className = 'key-container';
- container.appendChild(divElement);
- divElement.appendChild(inputElement);
- divElement.appendChild(labelElement);
- }
- var brElement = document.createElement('br');
- container.appendChild(brElement);
- }
-
- if ($('cvoxKey') == null) {
- // Add the cvox key field
- var inputElement = document.createElement('input');
- inputElement.type = 'text';
- inputElement.className = 'key';
- inputElement.id = 'cvoxKey';
-
- var labelElement = document.createElement('label');
- labelElement.className = 'i18n';
- labelElement.setAttribute('msgid', 'options_cvox_modifier_key');
- labelElement.setAttribute('for', 'cvoxKey');
-
- var modifierSectionSibling =
- $('modifier_keys').nextSibling;
- var modifierSectionParent = modifierSectionSibling.parentNode;
- modifierSectionParent.insertBefore(labelElement, modifierSectionSibling);
- modifierSectionParent.insertBefore(inputElement, labelElement);
- var cvoxKey = $('cvoxKey');
- cvoxKey.value = localStorage['cvoxKey'];
-
- cvoxKey.addEventListener('keydown', function(evt) {
- if (!this.modifierSeq_) {
- this.modifierCount_ = 0;
- this.modifierSeq_ = new cvox.KeySequence(evt, false);
- } else {
- this.modifierSeq_.addKeyEvent(evt);
- }
-
- // Never allow non-modified keys.
- if (!this.modifierSeq_.isAnyModifierActive()) {
- // Indicate error and instructions excluding tab.
- if (evt.keyCode != 9) {
- cvox.OptionsPage.speak(
- Msgs.getMsg('modifier_entry_error'),
- cvox.QueueMode.FLUSH, {});
- }
- this.modifierSeq_ = null;
- } else {
- this.modifierCount_++;
- }
-
- // Don't trap tab or shift.
- if (!evt.shiftKey && evt.keyCode != 9) {
- evt.preventDefault();
- evt.stopPropagation();
- }
- }, true);
-
- cvoxKey.addEventListener('keyup', function(evt) {
- if (this.modifierSeq_) {
- this.modifierCount_--;
-
- if (this.modifierCount_ == 0) {
- var modifierStr =
- cvox.KeyUtil.keySequenceToString(this.modifierSeq_, true, true);
- evt.target.value = modifierStr;
- cvox.OptionsPage.speak(
- Msgs.getMsg('modifier_entry_set', [modifierStr]),
- cvox.QueueMode.QUEUE);
- localStorage['cvoxKey'] = modifierStr;
- this.modifierSeq_ = null;
- }
- evt.preventDefault();
- evt.stopPropagation();
- }
- }, true);
- }
-};
-
-/**
- * Populates the voices select with options.
- */
-cvox.OptionsPage.populateVoicesSelect = function() {
- var select = $('voices');
-
- function setVoiceList() {
- chrome.storage.local.get('voiceName', function(items) {
- var selectedVoiceName = items.voiceName;
- chrome.tts.getVoices(function(voices) {
- select.innerHTML = '';
- // TODO(plundblad): voiceName can actually be omitted in the TTS
- // engine. We should generate a name in that case.
- voices.forEach(function(voice) {
- voice.voiceName = voice.voiceName || '';
- });
- voices.sort(function(a, b) {
- return a.voiceName.localeCompare(b.voiceName);
- });
- voices.forEach(function(voice) {
- var option = document.createElement('option');
- option.voiceName = voice.voiceName;
- option.innerText = option.voiceName;
- if (selectedVoiceName === voice.voiceName) {
- option.setAttribute('selected', '');
- }
- select.add(option);
- });
- });
- });
- }
-
- window.speechSynthesis.onvoiceschanged = setVoiceList;
- setVoiceList();
-
- select.addEventListener('change', function(evt) {
- var selIndex = select.selectedIndex;
- var sel = select.options[selIndex];
- chrome.storage.local.set({voiceName: sel.voiceName});
- }, true);
-};
-
-/**
- * Populates the braille select control.
- */
-cvox.OptionsPage.populateBrailleTablesSelect = function() {
- if (!cvox.ChromeVox.isChromeOS) {
- return;
- }
- var tables = cvox.OptionsPage.brailleTables;
- var populateSelect = function(node, dots) {
- var activeTable = localStorage[node.id] || localStorage['brailleTable'];
- // Gather the display names and sort them according to locale.
- var items = [];
- for (var i = 0, table; table = tables[i]; i++) {
- if (table.dots !== dots) {
- continue;
- }
- items.push({id: table.id,
- name: cvox.BrailleTable.getDisplayName(table)});
- }
- items.sort(function(a, b) { return a.name.localeCompare(b.name);});
- for (var i = 0, item; item = items[i]; ++i) {
- var elem = document.createElement('option');
- elem.id = item.id;
- elem.textContent = item.name;
- if (item.id == activeTable) {
- elem.setAttribute('selected', '');
- }
- node.appendChild(elem);
- }
- };
- var select6 = $('brailleTable6');
- var select8 = $('brailleTable8');
- populateSelect(select6, '6');
- populateSelect(select8, '8');
-
- var handleBrailleSelect = function(node) {
- return function(evt) {
- var selIndex = node.selectedIndex;
- var sel = node.options[selIndex];
- localStorage['brailleTable'] = sel.id;
- localStorage[node.id] = sel.id;
- cvox.OptionsPage.getBrailleTranslatorManager().refresh();
- };
- };
-
- select6.addEventListener('change', handleBrailleSelect(select6), true);
- select8.addEventListener('change', handleBrailleSelect(select8), true);
-
- var tableTypeButton = $('brailleTableType');
- var updateTableType = function(setFocus) {
- var currentTableType = localStorage['brailleTableType'] || 'brailleTable6';
- if (currentTableType == 'brailleTable6') {
- select6.removeAttribute('aria-hidden');
- select6.setAttribute('tabIndex', 0);
- select6.style.display = 'block';
- if (setFocus) {
- select6.focus();
- }
- select8.setAttribute('aria-hidden', 'true');
- select8.setAttribute('tabIndex', -1);
- select8.style.display = 'none';
- localStorage['brailleTable'] = localStorage['brailleTable6'];
- localStorage['brailleTableType'] = 'brailleTable6';
- tableTypeButton.textContent =
- Msgs.getMsg('options_braille_table_type_6');
- } else {
- select6.setAttribute('aria-hidden', 'true');
- select6.setAttribute('tabIndex', -1);
- select6.style.display = 'none';
- select8.removeAttribute('aria-hidden');
- select8.setAttribute('tabIndex', 0);
- select8.style.display = 'block';
- if (setFocus) {
- select8.focus();
- }
- localStorage['brailleTable'] = localStorage['brailleTable8'];
- localStorage['brailleTableType'] = 'brailleTable8';
- tableTypeButton.textContent =
- Msgs.getMsg('options_braille_table_type_8');
- }
- cvox.OptionsPage.getBrailleTranslatorManager().refresh();
- };
- updateTableType(false);
-
- tableTypeButton.addEventListener('click', function(evt) {
- var oldTableType = localStorage['brailleTableType'];
- localStorage['brailleTableType'] =
- oldTableType == 'brailleTable6' ? 'brailleTable8' : 'brailleTable6';
- updateTableType(true);
- }, true);
-};
-
-/**
- * Set the html element for a preference to match the given value.
- * @param {Element} element The HTML control.
- * @param {string} value The new value.
- */
-cvox.OptionsPage.setValue = function(element, value) {
- if (element.tagName == 'INPUT' && element.type == 'checkbox') {
- element.checked = (value == 'true');
- } else if (element.tagName == 'INPUT' && element.type == 'radio') {
- element.checked = (String(element.value) == value);
- } else {
- element.value = value;
- }
-};
-
-/**
- * Event listener, called when an event occurs in the page that might
- * affect one of the preference controls.
- * @param {Event} event The event.
- * @return {boolean} True if the default action should occur.
- */
-cvox.OptionsPage.eventListener = function(event) {
- window.setTimeout(function() {
- var target = event.target;
- if (target.id == 'brailleWordWrap') {
- chrome.storage.local.set({brailleWordWrap: target.checked});
- } else if (target.classList.contains('pref')) {
- if (target.tagName == 'INPUT' && target.type == 'checkbox') {
- cvox.OptionsPage.prefs.setPref(target.name, target.checked);
- } else if (target.tagName == 'INPUT' && target.type == 'radio') {
- var key = target.name;
- var elements = document.querySelectorAll('*[name="' + key + '"]');
- for (var i = 0; i < elements.length; i++) {
- if (elements[i].checked) {
- cvox.OptionsPage.prefs.setPref(target.name, elements[i].value);
- }
- }
- }
- } else if (target.classList.contains('key')) {
- var keySeq = cvox.KeySequence.fromStr(target.value);
- var success = false;
- if (target.id == 'cvoxKey') {
- cvox.OptionsPage.prefs.setPref(target.id, target.value);
- cvox.OptionsPage.prefs.sendPrefsToAllTabs(true, true);
- success = true;
- } else {
- success =
- cvox.OptionsPage.prefs.setKey(target.id, keySeq);
-
- // TODO(dtseng): Don't surface conflicts until we have a better
- // workflow.
- }
- }
- }, 0);
- return true;
-};
-
-/**
- * Refreshes all dynamic content on the page.
- * This includes all key related information.
- */
-cvox.OptionsPage.reset = function() {
- var selectKeyMap = $('cvox_keymaps');
- var id = selectKeyMap.options[selectKeyMap.selectedIndex].id;
-
- var msgs = Msgs;
- var announce = cvox.OptionsPage.prefs.getPrefs()['currentKeyMap'] == id ?
- msgs.getMsg('keymap_reset', [msgs.getMsg(id)]) :
- msgs.getMsg('keymap_switch', [msgs.getMsg(id)]);
- cvox.OptionsPage.updateStatus_(announce);
-
- cvox.OptionsPage.prefs.switchToKeyMap(id);
- $('keysContainer').innerHTML = '';
- cvox.OptionsPage.addKeys();
- Msgs.addTranslatedMessagesToDom(document);
-};
-
-/**
- * Updates the status live region.
- * @param {string} status The new status.
- * @private
- */
-cvox.OptionsPage.updateStatus_ = function(status) {
- $('status').innerText = status;
-};
-
-
-/**
- * Hides all elements not matching the current platform.
- */
-cvox.OptionsPage.hidePlatformSpecifics = function() {
- if (!cvox.ChromeVox.isChromeOS) {
- var elements = document.body.querySelectorAll('.chromeos');
- for (var i = 0, el; el = elements[i]; i++) {
- el.setAttribute('aria-hidden', 'true');
- el.style.display = 'none';
- }
- }
-};
-
-
-/**
- * Calls a {@code cvox.TtsInterface.speak} method in the background page to
- * speak an utterance. See that method for further details.
- * @param {string} textString The string of text to be spoken.
- * @param {cvox.QueueMode} queueMode The queue mode to use.
- * @param {Object=} properties Speech properties to use for this utterance.
- */
-cvox.OptionsPage.speak = function(textString, queueMode, properties) {
- var speak =
- /** @type Function} */ (chrome.extension.getBackgroundPage()['speak']);
- speak.apply(null, arguments);
-};
-
-/**
- * @return {cvox.BrailleTranslatorManager}
- */
-cvox.OptionsPage.getBrailleTranslatorManager = function() {
- return chrome.extension.getBackgroundPage()['braille_translator_manager'];
-};
-
-document.addEventListener('DOMContentLoaded', function() {
- cvox.OptionsPage.init();
-}, false);
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options_loader.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options_loader.js
deleted file mode 100644
index ec7999afeab..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/options_loader.js
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Loads the options script.
- *
- */
-
-goog.require('cvox.OptionsPage');
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/prefs.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/prefs.js
deleted file mode 100644
index a0d64ef86fa..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/prefs.js
+++ /dev/null
@@ -1,231 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Common page for reading and writing preferences from
- * the background context (background page or options page).
- *
- */
-
-goog.provide('cvox.ChromeVoxPrefs');
-
-goog.require('cvox.ChromeVox');
-goog.require('cvox.ExtensionBridge');
-goog.require('cvox.KeyMap');
-
-
-/**
- * This object has default values of preferences and contains the common
- * code for working with preferences shared by the Options and Background
- * pages.
- * @constructor
- */
-cvox.ChromeVoxPrefs = function() {
- var lastRunVersion = localStorage['lastRunVersion'];
- if (!lastRunVersion) {
- lastRunVersion = '1.16.0';
- }
- var loadExistingSettings = true;
- // TODO(dtseng): Logic below needs clarification. Perhaps needs a
- // 'lastIncompatibleVersion' member.
- if (lastRunVersion == '1.16.0') {
- loadExistingSettings = false;
- }
- localStorage['lastRunVersion'] = chrome.runtime.getManifest().version;
-
- /**
- * The current mapping from keys to command.
- * @type {!cvox.KeyMap}
- * @private
- */
- this.keyMap_ = cvox.KeyMap.fromLocalStorage() || cvox.KeyMap.fromDefaults();
- this.keyMap_.merge(cvox.KeyMap.fromDefaults());
-
- // Clear per session preferences.
- // This is to keep the position dictionary from growing excessively large.
- localStorage['position'] = '{}';
-
- // Default per session sticky to off.
- localStorage['sticky'] = false;
-
- this.init(loadExistingSettings);
-};
-
-
-/**
- * The default value of all preferences except the key map.
- * @const
- * @type {Object<Object>}
- */
-cvox.ChromeVoxPrefs.DEFAULT_PREFS = {
- 'active': true,
- 'brailleCaptions': false,
- // TODO(dtseng): Leaking state about multiple key maps here until we have a
- // class to manage multiple key maps. Also, this doesn't belong as a pref;
- // should just store in local storage.
- 'currentKeyMap' : cvox.KeyMap.DEFAULT_KEYMAP,
- 'cvoxKey': '',
- 'earcons': true,
- 'focusFollowsMouse': false,
- 'granularity': undefined,
- 'position': '{}',
- 'siteSpecificScriptBase':
- 'https://ssl.gstatic.com/accessibility/javascript/ext/',
- 'siteSpecificScriptLoader':
- 'https://ssl.gstatic.com/accessibility/javascript/ext/loader.js',
- 'sticky': false,
- 'typingEcho': 0,
- 'useIBeamCursor': cvox.ChromeVox.isMac,
- 'useVerboseMode': true,
- 'siteSpecificEnhancements': true
-};
-
-
-/**
- * Merge the default values of all known prefs with what's found in
- * localStorage.
- * @param {boolean} pullFromLocalStorage or not to pull prefs from local
- * storage. True if we want to respect changes the user has already made
- * to prefs, false if we want to overwrite them. Set false if we've made
- * changes to keyboard shortcuts and need to make sure they aren't
- * overridden by the old keymap in local storage.
- */
-cvox.ChromeVoxPrefs.prototype.init = function(pullFromLocalStorage) {
- // Set the default value of any pref that isn't already in localStorage.
- for (var pref in cvox.ChromeVoxPrefs.DEFAULT_PREFS) {
- if (localStorage[pref] === undefined) {
- localStorage[pref] = cvox.ChromeVoxPrefs.DEFAULT_PREFS[pref];
- }
- }
-};
-
-/**
- * Switches to another key map.
- * @param {string} selectedKeyMap The id of the keymap in
- * cvox.KeyMap.AVAIABLE_KEYMAP_INFO.
-*/
-cvox.ChromeVoxPrefs.prototype.switchToKeyMap = function(selectedKeyMap) {
- // TODO(dtseng): Leaking state about multiple key maps here until we have a
- // class to manage multiple key maps.
- localStorage['currentKeyMap'] = selectedKeyMap;
- this.keyMap_ = cvox.KeyMap.fromCurrentKeyMap();
- this.keyMap_.toLocalStorage();
- this.keyMap_.resetModifier();
- this.sendPrefsToAllTabs(false, true);
-};
-
-
-/**
- * Get the prefs (not including keys).
- * @return {Object} A map of all prefs except the key map from localStorage.
- */
-cvox.ChromeVoxPrefs.prototype.getPrefs = function() {
- var prefs = {};
- for (var pref in cvox.ChromeVoxPrefs.DEFAULT_PREFS) {
- prefs[pref] = localStorage[pref];
- }
- prefs['version'] = chrome.runtime.getManifest().version;
- return prefs;
-};
-
-
-/**
- * Reloads the key map from local storage.
- */
-cvox.ChromeVoxPrefs.prototype.reloadKeyMap = function() {
- // Get the current key map from localStorage.
- // TODO(dtseng): We currently don't support merges since we write the entire
- // map back to local storage.
- var currentKeyMap = cvox.KeyMap.fromLocalStorage();
- if (!currentKeyMap) {
- currentKeyMap = cvox.KeyMap.fromCurrentKeyMap();
- currentKeyMap.toLocalStorage();
- }
- this.keyMap_ = currentKeyMap;
-};
-
-
-/**
- * Get the key map, from key binding to an array of [command, description].
- * @return {cvox.KeyMap} The key map.
- */
-cvox.ChromeVoxPrefs.prototype.getKeyMap = function() {
- return this.keyMap_;
-};
-
-
-/**
- * Reset to the default key bindings.
- */
-cvox.ChromeVoxPrefs.prototype.resetKeys = function() {
- this.keyMap_ = cvox.KeyMap.fromDefaults();
- this.keyMap_.toLocalStorage();
- this.sendPrefsToAllTabs(false, true);
-};
-
-
-/**
- * Send all of the settings to all tabs.
- * @param {boolean} sendPrefs Whether to send the prefs.
- * @param {boolean} sendKeyBindings Whether to send the key bindings.
- */
-cvox.ChromeVoxPrefs.prototype.sendPrefsToAllTabs =
- function(sendPrefs, sendKeyBindings) {
- var context = this;
- var message = {};
- if (sendPrefs) {
- message['prefs'] = context.getPrefs();
- }
- if (sendKeyBindings) {
- // Note that cvox.KeyMap stringifies to a minimal object when message gets
- // passed to the content script.
- message['keyBindings'] = this.keyMap_.toJSON();
- }
- chrome.windows.getAll({populate: true}, function(windows) {
- for (var i = 0; i < windows.length; i++) {
- var tabs = windows[i].tabs;
- for (var j = 0; j < tabs.length; j++) {
- chrome.tabs.sendMessage(tabs[j].id, message);
- }
- }
- });
-};
-
-/**
- * Send all of the settings over the specified port.
- * @param {Port} port The port representing the connection to a content script.
- */
-cvox.ChromeVoxPrefs.prototype.sendPrefsToPort = function(port) {
- port.postMessage({
- 'keyBindings': this.keyMap_.toJSON(),
- 'prefs': this.getPrefs()});
-};
-
-
-/**
- * Set the value of a pref and update all active tabs if it's changed.
- * @param {string} key The pref key.
- * @param {Object|string} value The new value of the pref.
- */
-cvox.ChromeVoxPrefs.prototype.setPref = function(key, value) {
- if (localStorage[key] != value) {
- localStorage[key] = value;
- this.sendPrefsToAllTabs(true, false);
- }
-};
-
-/**
- * Delegates to cvox.KeyMap.
- * @param {string} command The command to set.
- * @param {cvox.KeySequence} newKey The new key to assign it to.
- * @return {boolean} True if the key was bound to the command.
- */
-cvox.ChromeVoxPrefs.prototype.setKey = function(command, newKey) {
- if (this.keyMap_.rebind(command, newKey)) {
- this.keyMap_.toLocalStorage();
- this.sendPrefsToAllTabs(false, true);
- return true;
- }
- return false;
-};
diff --git a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js b/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
deleted file mode 100644
index 4719c1558ca..00000000000
--- a/chromium/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview Accesses Chrome's tabs extension API and gives
- * feedback for events that happen in the "Chrome of Chrome".
- */
-
-goog.provide('cvox.TabsApiHandler');
-
-goog.require('cvox.AbstractEarcons');
-goog.require('cvox.AbstractTts');
-goog.require('cvox.BrailleInterface');
-goog.require('cvox.ChromeVox');
-goog.require('cvox.NavBraille');
-
-
-/**
- * Class that adds listeners and handles events from the tabs API.
- * @constructor
- * @param {cvox.TtsInterface} tts The TTS to use for speaking.
- * @param {cvox.BrailleInterface} braille The braille interface to use for
- * brailling.
- * @param {cvox.AbstractEarcons} earcons The earcons object to use for playing
- * earcons.
- */
-cvox.TabsApiHandler = function(tts, braille, earcons) {
- /** @type {cvox.TtsInterface} @private */
- this.tts_ = tts;
- /** @type {cvox.BrailleInterface} @private */
- this.braille_ = braille;
- /** @type {cvox.AbstractEarcons} @private */
- this.earcons_ = earcons;
- /** @type {function(string, Array<string>=)} @private */
- this.msg_ = Msgs.getMsg.bind(Msgs);
- /**
- * Tracks whether the active tab has finished loading.
- * @type {boolean}
- * @private
- */
- this.lastActiveTabLoaded_ = false;
-
- chrome.tabs.onCreated.addListener(this.onCreated.bind(this));
- chrome.tabs.onRemoved.addListener(this.onRemoved.bind(this));
- chrome.tabs.onActivated.addListener(this.onActivated.bind(this));
- chrome.tabs.onUpdated.addListener(this.onUpdated.bind(this));
- chrome.windows.onFocusChanged.addListener(this.onFocusChanged.bind(this));
-};
-
-cvox.TabsApiHandler.prototype = {
- /**
- * Handles chrome.tabs.onCreated.
- * @param {Object} tab
- */
- onCreated: function(tab) {
- if (!cvox.ChromeVox.isActive) {
- return;
- }
- this.tts_.speak(this.msg_('chrome_tab_created'),
- cvox.QueueMode.FLUSH,
- cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
- this.braille_.write(
- cvox.NavBraille.fromText(this.msg_('chrome_tab_created')));
- this.earcons_.playEarcon(cvox.Earcon.OBJECT_OPEN);
- },
-
- /**
- * Handles chrome.tabs.onRemoved.
- * @param {Object} tab
- */
- onRemoved: function(tab) {
- if (!cvox.ChromeVox.isActive) {
- return;
- }
- this.earcons_.playEarcon(cvox.Earcon.OBJECT_CLOSE);
- },
-
- /**
- * Handles chrome.tabs.onActivated.
- * @param {Object} activeInfo
- */
- onActivated: function(activeInfo) {
- if (!cvox.ChromeVox.isActive) {
- return;
- }
- chrome.tabs.get(activeInfo.tabId, function(tab) {
- this.lastActiveTabLoaded_ = tab.status == 'complete';
- if (tab.status == 'loading') {
- return;
- }
- var title = tab.title ? tab.title : tab.url;
- this.tts_.speak(this.msg_('chrome_tab_selected',
- [title]),
- cvox.QueueMode.FLUSH,
- cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
- this.braille_.write(
- cvox.NavBraille.fromText(this.msg_('chrome_tab_selected', [title])));
- this.earcons_.playEarcon(cvox.Earcon.OBJECT_SELECT);
- }.bind(this));
- },
-
- /**
- * Handles chrome.tabs.onUpdated.
- * @param {number} tabId
- * @param {Object} selectInfo
- */
- onUpdated: function(tabId, selectInfo) {
- if (!cvox.ChromeVox.isActive) {
- return;
- }
- chrome.tabs.get(tabId, function(tab) {
- if (!tab.active) {
- return;
- }
- if (tab.status == 'loading') {
- this.lastActiveTabLoaded_ = false;
- this.earcons_.playEarcon(cvox.Earcon.PAGE_START_LOADING);
- } else if (!this.lastActiveTabLoaded_) {
- this.lastActiveTabLoaded_ = true;
- this.earcons_.playEarcon(cvox.Earcon.PAGE_FINISH_LOADING);
- }
- }.bind(this));
- },
-
- /**
- * Handles chrome.windows.onFocusChanged.
- * @param {number} windowId
- */
- onFocusChanged: function(windowId) {
- if (!cvox.ChromeVox.isActive) {
- return;
- }
- if (windowId == chrome.windows.WINDOW_ID_NONE) {
- return;
- }
- chrome.windows.get(windowId, function(window) {
- chrome.tabs.query({active: true, windowId: windowId}, function(tabs) {
- var msgId = window.incognito ? 'chrome_incognito_window_selected' :
- 'chrome_normal_window_selected';
- var tab = tabs[0] || {};
- var title = tab.title ? tab.title : tab.url;
- this.tts_.speak(this.msg_(msgId, [title]),
- cvox.QueueMode.FLUSH,
- cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
- this.braille_.write(
- cvox.NavBraille.fromText(this.msg_(msgId, [title])));
- this.earcons_.playEarcon(cvox.Earcon.OBJECT_SELECT);
- }.bind(this));
- }.bind(this));
- }
-};