OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Handles automation from a desktop automation node. | 6 * @fileoverview Handles automation from a desktop automation node. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('DesktopAutomationHandler'); | 9 goog.provide('DesktopAutomationHandler'); |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 * @private | 40 * @private |
41 */ | 41 */ |
42 this.lastValueChanged_ = new Date(0); | 42 this.lastValueChanged_ = new Date(0); |
43 | 43 |
44 var e = EventType; | 44 var e = EventType; |
45 this.addListener_(e.activedescendantchanged, this.onActiveDescendantChanged); | 45 this.addListener_(e.activedescendantchanged, this.onActiveDescendantChanged); |
46 this.addListener_(e.alert, this.onAlert); | 46 this.addListener_(e.alert, this.onAlert); |
47 this.addListener_(e.ariaAttributeChanged, this.onEventIfInRange); | 47 this.addListener_(e.ariaAttributeChanged, this.onEventIfInRange); |
48 this.addListener_(e.checkedStateChanged, this.onEventIfInRange); | 48 this.addListener_(e.checkedStateChanged, this.onEventIfInRange); |
49 this.addListener_(e.focus, this.onFocus); | 49 this.addListener_(e.focus, this.onFocus); |
50 this.addListener_(e.hover, this.onEventWithFlushedOutput); | 50 this.addListener_(e.hover, this.onHover); |
51 this.addListener_(e.loadComplete, this.onLoadComplete); | 51 this.addListener_(e.loadComplete, this.onLoadComplete); |
52 this.addListener_(e.menuEnd, this.onMenuEnd); | 52 this.addListener_(e.menuEnd, this.onMenuEnd); |
53 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); | 53 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); |
54 this.addListener_(e.menuStart, this.onMenuStart); | 54 this.addListener_(e.menuStart, this.onMenuStart); |
55 this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged); | 55 this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged); |
56 this.addListener_(e.selection, this.onSelection); | 56 this.addListener_(e.selection, this.onSelection); |
57 this.addListener_(e.textChanged, this.onTextChanged); | 57 this.addListener_(e.textChanged, this.onTextChanged); |
58 this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged); | 58 this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged); |
59 this.addListener_(e.valueChanged, this.onValueChanged); | 59 this.addListener_(e.valueChanged, this.onValueChanged); |
60 | 60 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 /** | 154 /** |
155 * @param {!AutomationEvent} evt | 155 * @param {!AutomationEvent} evt |
156 */ | 156 */ |
157 onEventWithFlushedOutput: function(evt) { | 157 onEventWithFlushedOutput: function(evt) { |
158 Output.flushNextSpeechUtterance(); | 158 Output.flushNextSpeechUtterance(); |
159 this.onEventDefault(evt); | 159 this.onEventDefault(evt); |
160 }, | 160 }, |
161 | 161 |
162 /** | 162 /** |
| 163 * @param {!AutomationEvent} evt |
| 164 */ |
| 165 onHover: function(evt) { |
| 166 if (ChromeVoxState.instance.currentRange && |
| 167 evt.target == ChromeVoxState.instance.currentRange.start.node) |
| 168 return; |
| 169 Output.flushNextSpeechUtterance(); |
| 170 this.onEventDefault(evt); |
| 171 }, |
| 172 |
| 173 /** |
163 * Makes an announcement without changing focus. | 174 * Makes an announcement without changing focus. |
164 * @param {!AutomationEvent} evt | 175 * @param {!AutomationEvent} evt |
165 */ | 176 */ |
166 onActiveDescendantChanged: function(evt) { | 177 onActiveDescendantChanged: function(evt) { |
167 if (!evt.target.activeDescendant) | 178 if (!evt.target.activeDescendant) |
168 return; | 179 return; |
169 this.onEventDefault(new chrome.automation.AutomationEvent( | 180 this.onEventDefault(new chrome.automation.AutomationEvent( |
170 EventType.focus, evt.target.activeDescendant)); | 181 EventType.focus, evt.target.activeDescendant)); |
171 }, | 182 }, |
172 | 183 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 if (cvox.ChromeVox.isMac) | 398 if (cvox.ChromeVox.isMac) |
388 return; | 399 return; |
389 chrome.automation.getDesktop(function(desktop) { | 400 chrome.automation.getDesktop(function(desktop) { |
390 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); | 401 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); |
391 }); | 402 }); |
392 }; | 403 }; |
393 | 404 |
394 DesktopAutomationHandler.init_(); | 405 DesktopAutomationHandler.init_(); |
395 | 406 |
396 }); // goog.scope | 407 }); // goog.scope |
OLD | NEW |