forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide skeleton for ChromeVox next.
BUG=372578 NOTRY=true Review URL: https://codereview.chromium.org/272013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271293 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
dtseng@chromium.org
committed
May 18, 2014
1 parent
e3d7486
commit b3819c2
Showing
12 changed files
with
213 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
aboxhall@chromium.org | ||
dmazzoni@chromium.org | ||
dtseng@chromium.org | ||
plundblad@chromium.org |
31 changes: 31 additions & 0 deletions
31
chrome/browser/resources/chromeos/chromevox2/chromevox.gyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 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. | ||
|
||
{ | ||
'conditions': [ | ||
['chromeos==1 and disable_nacl==0 and disable_nacl_untrusted==0', { | ||
'targets': [ | ||
{ | ||
'target_name': 'chromevox2_resources', | ||
'type': 'none', | ||
'copies': [ | ||
{ | ||
'destination': '<(PRODUCT_DIR)/resources/chromeos/chromevox/cvox2/background', | ||
'files': [ | ||
'cvox2/background/background.html', | ||
'cvox2/background/background.js', | ||
], | ||
}, | ||
{ | ||
'destination': '<(PRODUCT_DIR)/resources/chromeos/chromevox/cvox2/injected', | ||
'files': [ | ||
'cvox2/injected/injected.js', | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}], | ||
], | ||
} |
5 changes: 5 additions & 0 deletions
5
chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- ChromeVox classic --> | ||
<script src="../../chromeVoxChromeBackgroundScript.js"></script> | ||
|
||
<!-- ChromeVox Next --> | ||
<script src="background.js"></script> |
93 changes: 93 additions & 0 deletions
93
chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// 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 The entry point for all ChromeVox2 related code for the | ||
* background page. | ||
*/ | ||
|
||
/** ChromeVox2 namespace */ | ||
var cvox2 = function() {}; | ||
|
||
/** Namespace for global objects in the background page. */ | ||
cvox2.global = function() {}; | ||
|
||
/** Classic Chrome accessibility API. */ | ||
cvox2.global.accessibility = | ||
chrome.accessibilityPrivate || chrome.experimental.accessibility; | ||
|
||
/** | ||
* ChromeVox2 background page. | ||
*/ | ||
cvox2.Background = function() { | ||
// Only needed with unmerged ChromeVox classic loaded before. | ||
cvox2.global.accessibility.setAccessibilityEnabled(false); | ||
chrome.automation.getDesktop(this.onGotDesktop.bind(this)); | ||
}; | ||
|
||
cvox2.Background.prototype = { | ||
/** | ||
* ID of the port used to communicate between content script and background | ||
* page. | ||
* @const {string} | ||
*/ | ||
PORT_ID: 'chromevox2', | ||
|
||
/** | ||
* Waits until a desktop automation tree becomes available. | ||
* Thereafter, registers a simple exploration mode for the desktop tree. | ||
* @param {AutomationTree} tree The desktop automation tree. | ||
*/ | ||
onGotDesktop: function(tree) { | ||
if (!tree.root) { | ||
window.setTimeout(this.onGotDesktop, 500); | ||
return; | ||
} | ||
chrome.extension.onConnect.addListener(function(port) { | ||
if (port.name != this.PORT_ID) | ||
return; | ||
var cur = tree.root; | ||
port.onMessage.addListener(function(message) { | ||
switch (message.keydown) { | ||
case 37: | ||
cur = cur.previousSibling() || cur; | ||
break; | ||
case 38: | ||
cur = cur.parent() || cur; | ||
break; | ||
case 39: | ||
cur = cur.nextSibling() || cur; | ||
break; | ||
case 40: | ||
cur = cur.firstChild() || cur; | ||
break; | ||
} | ||
var index = 1; | ||
if (cur.parent()) | ||
index = cur.parent().children().indexOf(cur) + 1; | ||
var name = ''; | ||
if (cur.attributes && cur.attributes['ax_attr_name']) | ||
name = cur.attributes['ax_attr_name']; | ||
var utterance = index + ' ' + name + cur.role; | ||
chrome.tts.speak(String(utterance), {lang: 'en-US'}); | ||
}); | ||
}.bind(this)); | ||
|
||
// Register all automation event listeners. | ||
tree.root.addEventListener('focus', this.onDesktopEvent.bind(this), true); | ||
}, | ||
|
||
/** | ||
* A generic handler for all desktop automation events. | ||
* @param {AutomationEvent} evt The event. | ||
*/ | ||
onDesktopEvent: function(evt) { | ||
var output = evt.target.attributes.name + ' ' + evt.target.role; | ||
cvox.ChromeVox.tts.speak(output); | ||
cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(output)); | ||
} | ||
}; | ||
|
||
/** @type {cvox2.Background} */ | ||
cvox2.global.backgroundObj = new cvox2.Background(); |
19 changes: 19 additions & 0 deletions
19
chrome/browser/resources/chromeos/chromevox2/cvox2/injected/injected.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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 The entry point for all ChromeVox2 related code for the | ||
* injected content script. | ||
* This script will temporarily forward any events we need during the | ||
* ChromeVox/ChromeVox2 timeframe where extension APIs do not exist (e.g. | ||
* keyboard events). | ||
*/ | ||
|
||
/** namespace */ | ||
var cvox2 = function() {}; | ||
|
||
var port = chrome.extension.connect({name: 'chromevox2'}); | ||
document.body.addEventListener('keydown', function(evt) { | ||
port.postMessage({keydown: evt.keyCode}); | ||
}, true); |
38 changes: 38 additions & 0 deletions
38
chrome/browser/resources/chromeos/chromevox2/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDltVl1k15pjRzuZfMc3B69inxwm2bZeZ2O8/zFO+NluHnBm3GJ3fzdOoFGJd+M16I8p7zxxQyHeDMfWYASyCeB8XnUEDKjqNLQfCnncsANzHsYoEbYj2nEUML2P13b9q+AAvpCBpAJ4cZp81e9n1y/vbSXHE4385cgkKueItzikQIDAQAB", | ||
"manifest_version": 2, | ||
"name": "ChromeVox", | ||
"version": "1.0", | ||
"description": "ChromeVox - Giving Voice to Chrome.", | ||
"background": { | ||
"page": "cvox2/background/background.html" | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ "<all_urls>" ], | ||
"exclude_globs": [ "chrome-extension://mndnfokpggljbaajbnioimlmbfngpief/chromevox/background/background.html" ], | ||
"all_frames": true, | ||
"js": [ | ||
"cvox2/injected/injected.js" | ||
] | ||
} | ||
], | ||
"permissions": [ | ||
"accessibilityPrivate", | ||
"automation", | ||
"bookmarks", | ||
"tabs", | ||
"experimental", | ||
"history", | ||
"tts", | ||
"systemPrivate", | ||
"brailleDisplayPrivate", | ||
"commandLinePrivate", | ||
"<all_urls>" | ||
], | ||
"automation": { | ||
"desktop": true, | ||
"interact": true | ||
}, | ||
"default_locale": "en" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters