Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js |
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js |
index 4c3e3d42c0f0ba27e40f7fc29a75fa8364a1fe45..26c6cbc9fc02e5109d4c7f1ad6534cc1bc1bffd6 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js |
@@ -32,6 +32,7 @@ DesktopAutomationHandler = function(node) { |
/** |
* The object that speaks changes to an editable text field. |
* @type {editing.TextEditHandler} |
+ * @private |
*/ |
this.textEditHandler_ = null; |
@@ -72,7 +73,8 @@ DesktopAutomationHandler = function(node) { |
if (focus) { |
this.onFocus( |
- new chrome.automation.AutomationEvent(EventType.focus, focus)); |
+ new chrome.automation.AutomationEvent( |
+ EventType.focus, focus, 'page')); |
} |
}).bind(this)); |
}.bind(this)); |
@@ -84,6 +86,12 @@ DesktopAutomationHandler = function(node) { |
*/ |
DesktopAutomationHandler.VMIN_VALUE_CHANGE_DELAY_MS = 500; |
+/** |
+ * Controls announcement of non-user-initiated events. |
+ * @type {boolean} |
+ */ |
+DesktopAutomationHandler.announceActions = false; |
+ |
DesktopAutomationHandler.prototype = { |
__proto__: BaseAutomationHandler.prototype, |
@@ -118,6 +126,10 @@ DesktopAutomationHandler.prototype = { |
ChromeVoxState.instance.currentRange.equals(prevRange)) |
return; |
+ // Decide whether to announce this event. |
+ if (!DesktopAutomationHandler.announceActions && evt.eventFrom == 'action') |
+ return; |
+ |
var output = new Output(); |
output.withRichSpeech( |
ChromeVoxState.instance.currentRange, prevRange, evt.type); |
@@ -187,7 +199,7 @@ DesktopAutomationHandler.prototype = { |
if (!evt.target.activeDescendant || !evt.target.state.focused) |
return; |
this.onEventDefault(new chrome.automation.AutomationEvent( |
- EventType.focus, evt.target.activeDescendant)); |
+ EventType.focus, evt.target.activeDescendant, evt.eventFrom)); |
}, |
/** |
@@ -220,7 +232,7 @@ DesktopAutomationHandler.prototype = { |
this.onEventIfInRange( |
new chrome.automation.AutomationEvent( |
- EventType.checkedStateChanged, evt.target)); |
+ EventType.checkedStateChanged, evt.target, evt.eventFrom)); |
}, |
/** |
@@ -245,8 +257,8 @@ DesktopAutomationHandler.prototype = { |
if (node.root.role == RoleType.desktop) |
Output.flushNextSpeechUtterance(); |
- this.onEventDefault( |
- new chrome.automation.AutomationEvent(EventType.focus, node)); |
+ this.onEventDefault(new chrome.automation.AutomationEvent( |
+ EventType.focus, node, evt.eventFrom)); |
}, |
/** |