Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 this.addListener_(EventType.CHECKED_STATE_CHANGED, | 55 this.addListener_(EventType.CHECKED_STATE_CHANGED, |
| 56 this.onCheckedStateChanged); | 56 this.onCheckedStateChanged); |
| 57 this.addListener_(EventType.CHILDREN_CHANGED, | 57 this.addListener_(EventType.CHILDREN_CHANGED, |
| 58 this.onActiveDescendantChanged); | 58 this.onActiveDescendantChanged); |
| 59 this.addListener_(EventType.EXPANDED_CHANGED, | 59 this.addListener_(EventType.EXPANDED_CHANGED, |
| 60 this.onEventIfInRange); | 60 this.onEventIfInRange); |
| 61 this.addListener_(EventType.FOCUS, | 61 this.addListener_(EventType.FOCUS, |
| 62 this.onFocus); | 62 this.onFocus); |
| 63 this.addListener_(EventType.HOVER, | 63 this.addListener_(EventType.HOVER, |
| 64 this.onHover); | 64 this.onHover); |
| 65 this.addListener_(EventType.IMAGE_FRAME_UPDATED, | |
| 66 this.onImageFrameUpdated); | |
| 65 this.addListener_(EventType.INVALID_STATUS_CHANGED, | 67 this.addListener_(EventType.INVALID_STATUS_CHANGED, |
| 66 this.onEventIfInRange); | 68 this.onEventIfInRange); |
| 67 this.addListener_(EventType.LOAD_COMPLETE, | 69 this.addListener_(EventType.LOAD_COMPLETE, |
| 68 this.onLoadComplete); | 70 this.onLoadComplete); |
| 69 this.addListener_(EventType.MENU_END, | 71 this.addListener_(EventType.MENU_END, |
| 70 this.onMenuEnd); | 72 this.onMenuEnd); |
| 71 this.addListener_(EventType.MENU_LIST_ITEM_SELECTED, | 73 this.addListener_(EventType.MENU_LIST_ITEM_SELECTED, |
| 72 this.onEventIfSelected); | 74 this.onEventIfSelected); |
| 73 this.addListener_(EventType.MENU_START, | 75 this.addListener_(EventType.MENU_START, |
| 74 this.onMenuStart); | 76 this.onMenuStart); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 ChromeVoxState.instance.setCurrentRange(selectedRange); | 408 ChromeVoxState.instance.setCurrentRange(selectedRange); |
| 407 } | 409 } |
| 408 | 410 |
| 409 // TODO(plundblad): This can currently be null for contenteditables. | 411 // TODO(plundblad): This can currently be null for contenteditables. |
| 410 // Clean up when it can't. | 412 // Clean up when it can't. |
| 411 if (this.textEditHandler_) | 413 if (this.textEditHandler_) |
| 412 this.textEditHandler_.onEvent(evt); | 414 this.textEditHandler_.onEvent(evt); |
| 413 }, | 415 }, |
| 414 | 416 |
| 415 /** | 417 /** |
| 418 * Provides all feedback once a image frame updated event fires. | |
| 419 * @param {!AutomationEvent} evt | |
| 420 */ | |
| 421 onImageFrameUpdated: function(evt) { | |
| 422 var node = evt.target; | |
|
David Tseng
2017/02/22 18:15:24
I don't think you need most or any of this. If thi
| |
| 423 if (!node) | |
| 424 return; | |
| 425 | |
| 426 // If |node| is NOT in the current range, return | |
| 427 var prevRange = ChromeVoxState.instance.currentRange; | |
| 428 if (!prevRange.contentEquals(cursors.Range.fromNode(node)) && | |
| 429 !node.state.focused) { | |
| 430 return; | |
| 431 } | |
| 432 | |
| 433 var output = new Output(); | |
| 434 if (!this.textEditHandler_) { | |
| 435 output.withBraille( | |
| 436 ChromeVoxState.instance.currentRange, prevRange, evt.type); | |
| 437 } else { | |
| 438 // Delegate event handling to the text edit handler for braille. | |
| 439 this.textEditHandler_.onEvent(evt); | |
| 440 } | |
| 441 output.go(); | |
| 442 }, | |
| 443 | |
| 444 /** | |
| 416 * Provides all feedback once a value changed event fires. | 445 * Provides all feedback once a value changed event fires. |
| 417 * @param {!AutomationEvent} evt | 446 * @param {!AutomationEvent} evt |
| 418 */ | 447 */ |
| 419 onValueChanged: function(evt) { | 448 onValueChanged: function(evt) { |
| 420 // Delegate to the edit text handler if this is an editable. | 449 // Delegate to the edit text handler if this is an editable. |
| 421 if (evt.target.state.editable) { | 450 if (evt.target.state.editable) { |
| 422 this.onEditableChanged_(evt); | 451 this.onEditableChanged_(evt); |
| 423 return; | 452 return; |
| 424 } | 453 } |
| 425 | 454 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 DesktopAutomationHandler.init_ = function() { | 573 DesktopAutomationHandler.init_ = function() { |
| 545 chrome.automation.getDesktop(function(desktop) { | 574 chrome.automation.getDesktop(function(desktop) { |
| 546 ChromeVoxState.desktopAutomationHandler = | 575 ChromeVoxState.desktopAutomationHandler = |
| 547 new DesktopAutomationHandler(desktop); | 576 new DesktopAutomationHandler(desktop); |
| 548 }); | 577 }); |
| 549 }; | 578 }; |
| 550 | 579 |
| 551 DesktopAutomationHandler.init_(); | 580 DesktopAutomationHandler.init_(); |
| 552 | 581 |
| 553 }); // goog.scope | 582 }); // goog.scope |
| OLD | NEW |