| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.onEventWithFlushedOutput); |
| 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.onEventDefault); | 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.onEventWithFlushedOutput); | 56 this.addListener_(e.selection, this.onEventWithFlushedOutput); |
| 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 |
| 61 AutomationObjectConstructorInstaller.init(node, function() { | 61 AutomationObjectConstructorInstaller.init(node, function() { |
| 62 chrome.automation.getFocus((function(focus) { | 62 chrome.automation.getFocus((function(focus) { |
| 63 if (ChromeVoxState.instance.mode != ChromeVoxMode.FORCE_NEXT) | 63 if (ChromeVoxState.instance.mode != ChromeVoxMode.FORCE_NEXT) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // TODO(dtseng): Consider the end of the current range as well. | 139 // TODO(dtseng): Consider the end of the current range as well. |
| 140 if (AutomationUtil.isDescendantOf( | 140 if (AutomationUtil.isDescendantOf( |
| 141 global.backgroundObj.currentRange.start.node, evt.target) || | 141 global.backgroundObj.currentRange.start.node, evt.target) || |
| 142 evt.target.state.focused) | 142 evt.target.state.focused) |
| 143 this.onEventDefault(evt); | 143 this.onEventDefault(evt); |
| 144 }, | 144 }, |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * @param {!AutomationEvent} evt | 147 * @param {!AutomationEvent} evt |
| 148 */ | 148 */ |
| 149 onEventIfSelected: function(evt) { |
| 150 if (evt.target.state.selected) |
| 151 this.onEventDefault(evt); |
| 152 }, |
| 153 |
| 154 /** |
| 155 * @param {!AutomationEvent} evt |
| 156 */ |
| 149 onEventWithFlushedOutput: function(evt) { | 157 onEventWithFlushedOutput: function(evt) { |
| 150 Output.flushNextSpeechUtterance(); | 158 Output.flushNextSpeechUtterance(); |
| 151 this.onEventDefault(evt); | 159 this.onEventDefault(evt); |
| 152 }, | 160 }, |
| 153 | 161 |
| 154 /** | 162 /** |
| 155 * Makes an announcement without changing focus. | 163 * Makes an announcement without changing focus. |
| 156 * @param {!AutomationEvent} evt | 164 * @param {!AutomationEvent} evt |
| 157 */ | 165 */ |
| 158 onActiveDescendantChanged: function(evt) { | 166 onActiveDescendantChanged: function(evt) { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 if (cvox.ChromeVox.isMac) | 374 if (cvox.ChromeVox.isMac) |
| 367 return; | 375 return; |
| 368 chrome.automation.getDesktop(function(desktop) { | 376 chrome.automation.getDesktop(function(desktop) { |
| 369 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); | 377 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); |
| 370 }); | 378 }); |
| 371 }; | 379 }; |
| 372 | 380 |
| 373 DesktopAutomationHandler.init_(); | 381 DesktopAutomationHandler.init_(); |
| 374 | 382 |
| 375 }); // goog.scope | 383 }); // goog.scope |
| OLD | NEW |