Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js

Issue 2544203004: Display images in multiline Braille
Patch Set: Minor Nits, added TODO comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 this.addListener_(e.menuEnd, this.onMenuEnd); 58 this.addListener_(e.menuEnd, this.onMenuEnd);
59 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); 59 this.addListener_(e.menuListItemSelected, this.onEventIfSelected);
60 this.addListener_(e.menuStart, this.onMenuStart); 60 this.addListener_(e.menuStart, this.onMenuStart);
61 this.addListener_(e.rowCollapsed, this.onEventIfInRange); 61 this.addListener_(e.rowCollapsed, this.onEventIfInRange);
62 this.addListener_(e.rowExpanded, this.onEventIfInRange); 62 this.addListener_(e.rowExpanded, this.onEventIfInRange);
63 this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged); 63 this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged);
64 this.addListener_(e.selection, this.onSelection); 64 this.addListener_(e.selection, this.onSelection);
65 this.addListener_(e.textChanged, this.onTextChanged); 65 this.addListener_(e.textChanged, this.onTextChanged);
66 this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged); 66 this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged);
67 this.addListener_(e.valueChanged, this.onValueChanged); 67 this.addListener_(e.valueChanged, this.onValueChanged);
68 this.addListener_(e.imageFrameUpdated, this.onImageFrameUpdated);
68 69
69 AutomationObjectConstructorInstaller.init(node, function() { 70 AutomationObjectConstructorInstaller.init(node, function() {
70 chrome.automation.getFocus((function(focus) { 71 chrome.automation.getFocus((function(focus) {
71 if (ChromeVoxState.instance.mode != ChromeVoxMode.FORCE_NEXT) 72 if (ChromeVoxState.instance.mode != ChromeVoxMode.FORCE_NEXT)
72 return; 73 return;
73 74
74 if (focus) { 75 if (focus) {
75 this.onFocus( 76 this.onFocus(
76 new chrome.automation.AutomationEvent( 77 new chrome.automation.AutomationEvent(
77 EventType.focus, focus, 'page')); 78 EventType.focus, focus, 'page'));
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 ChromeVoxState.instance.setCurrentRange(selectedRange); 380 ChromeVoxState.instance.setCurrentRange(selectedRange);
380 } 381 }
381 382
382 // TODO(plundblad): This can currently be null for contenteditables. 383 // TODO(plundblad): This can currently be null for contenteditables.
383 // Clean up when it can't. 384 // Clean up when it can't.
384 if (this.textEditHandler_) 385 if (this.textEditHandler_)
385 this.textEditHandler_.onEvent(evt); 386 this.textEditHandler_.onEvent(evt);
386 }, 387 },
387 388
388 /** 389 /**
390 * Provides all feedback once a image frame updated event fires.
391 * @param {!AutomationEvent} evt
392 */
393 onImageFrameUpdated: function(evt) {
394 var node = evt.target;
395 if (!node)
396 return;
397
398 // If |node| is NOT in the current range, return
399 var prevRange = ChromeVoxState.instance.currentRange;
400 if (!prevRange.contentEquals(cursors.Range.fromNode(node)) &&
401 !node.state.focused) {
402 return;
403 }
404
405 var output = new Output();
406 if (!this.textEditHandler_) {
407 output.withBraille(
408 ChromeVoxState.instance.currentRange, prevRange, evt.type);
409 } else {
410 // Delegate event handling to the text edit handler for braille.
411 this.textEditHandler_.onEvent(evt);
412 }
413 output.go();
414 },
415
416 /**
389 * Provides all feedback once a value changed event fires. 417 * Provides all feedback once a value changed event fires.
390 * @param {!AutomationEvent} evt 418 * @param {!AutomationEvent} evt
391 */ 419 */
392 onValueChanged: function(evt) { 420 onValueChanged: function(evt) {
393 // Delegate to the edit text handler if this is an editable. 421 // Delegate to the edit text handler if this is an editable.
394 if (evt.target.state.editable) { 422 if (evt.target.state.editable) {
395 this.onEditableChanged_(evt); 423 this.onEditableChanged_(evt);
396 return; 424 return;
397 } 425 }
398 426
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 DesktopAutomationHandler.init_ = function() { 546 DesktopAutomationHandler.init_ = function() {
519 chrome.automation.getDesktop(function(desktop) { 547 chrome.automation.getDesktop(function(desktop) {
520 ChromeVoxState.desktopAutomationHandler = 548 ChromeVoxState.desktopAutomationHandler =
521 new DesktopAutomationHandler(desktop); 549 new DesktopAutomationHandler(desktop);
522 }); 550 });
523 }; 551 };
524 552
525 DesktopAutomationHandler.init_(); 553 DesktopAutomationHandler.init_();
526 554
527 }); // goog.scope 555 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698