Commit 5e949a4c authored by dtseng's avatar dtseng Committed by Commit bot

Add a method to enable ChromeVox Next easily for the current run.

This cl adds a key sequence that enables ChromeVox Next. Eventually, this can turn into a proper option.

TEST=open ChromeVox options page, type 'n', 'e', 'x', 't'. Observe message and ChromeVox Next is enabled on all newly opened tabs.

Review URL: https://codereview.chromium.org/1107343006

Cr-Commit-Position: refs/heads/master@{#327541}
parent df96653f
...@@ -98,6 +98,31 @@ cvox.OptionsPage.init = function() { ...@@ -98,6 +98,31 @@ cvox.OptionsPage.init = function() {
$('version').textContent = $('version').textContent =
chrome.app.getDetails().version; 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);
}; };
/** /**
......
...@@ -77,6 +77,11 @@ Background = function() { ...@@ -77,6 +77,11 @@ Background = function() {
}; };
Background.prototype = { Background.prototype = {
/** Forces ChromeVox Next to be active for all tabs. */
forceChromeVoxNextActive: function() {
this.active_ = true;
},
/** /**
* Handles all setup once a new automation tree appears. * Handles all setup once a new automation tree appears.
* @param {chrome.automation.AutomationNode} desktop * @param {chrome.automation.AutomationNode} desktop
...@@ -248,7 +253,7 @@ Background.prototype = { ...@@ -248,7 +253,7 @@ Background.prototype = {
* @param {Object} evt * @param {Object} evt
*/ */
onLoadComplete: function(evt) { onLoadComplete: function(evt) {
var next = this.isWhitelisted_(evt.target.attributes.url); var next = this.isWhitelisted_(evt.target.attributes.url) || this.active_;
this.toggleChromeVoxVersion({next: next, classic: !next}); this.toggleChromeVoxVersion({next: next, classic: !next});
// Don't process nodes inside of web content if ChromeVox Next is inactive. // Don't process nodes inside of web content if ChromeVox Next is inactive.
if (evt.target.root.role != chrome.automation.RoleType.desktop && if (evt.target.root.role != chrome.automation.RoleType.desktop &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment