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) { | |
|
David Tseng
2017/02/24 05:39:46
Please move this event handler to CommandHandler (
dmazzoni
2017/02/27 06:56:24
Done.
| |
| 422 var node = evt.target; | |
| 423 if (!node || node != ChromeVoxState.instance.nodeDisplayingBrailleImage) | |
| 424 return; | |
| 425 | |
| 426 if (node.imageDataUrl) { | |
| 427 cvox.ChromeVox.braille.writeRawImage(node.imageDataUrl); | |
| 428 cvox.ChromeVox.braille.freeze(); | |
| 429 } | |
| 430 }, | |
| 431 | |
| 432 /** | |
| 416 * Provides all feedback once a value changed event fires. | 433 * Provides all feedback once a value changed event fires. |
| 417 * @param {!AutomationEvent} evt | 434 * @param {!AutomationEvent} evt |
| 418 */ | 435 */ |
| 419 onValueChanged: function(evt) { | 436 onValueChanged: function(evt) { |
| 420 // Delegate to the edit text handler if this is an editable. | 437 // Delegate to the edit text handler if this is an editable. |
| 421 if (evt.target.state.editable) { | 438 if (evt.target.state.editable) { |
| 422 this.onEditableChanged_(evt); | 439 this.onEditableChanged_(evt); |
| 423 return; | 440 return; |
| 424 } | 441 } |
| 425 | 442 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 DesktopAutomationHandler.init_ = function() { | 561 DesktopAutomationHandler.init_ = function() { |
| 545 chrome.automation.getDesktop(function(desktop) { | 562 chrome.automation.getDesktop(function(desktop) { |
| 546 ChromeVoxState.desktopAutomationHandler = | 563 ChromeVoxState.desktopAutomationHandler = |
| 547 new DesktopAutomationHandler(desktop); | 564 new DesktopAutomationHandler(desktop); |
| 548 }); | 565 }); |
| 549 }; | 566 }; |
| 550 | 567 |
| 551 DesktopAutomationHandler.init_(); | 568 DesktopAutomationHandler.init_(); |
| 552 | 569 |
| 553 }); // goog.scope | 570 }); // goog.scope |
| OLD | NEW |