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

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

Issue 2826423003: Expand Chrome OS ARC support to create one tree source per package (Closed)
Patch Set: One tree per app. Created 3 years, 7 months 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 this.lastValueChanged_ = new Date(0); 44 this.lastValueChanged_ = new Date(0);
45 45
46 this.addListener_(EventType.ACTIVEDESCENDANTCHANGED, 46 this.addListener_(EventType.ACTIVEDESCENDANTCHANGED,
47 this.onActiveDescendantChanged); 47 this.onActiveDescendantChanged);
48 this.addListener_(EventType.ALERT, 48 this.addListener_(EventType.ALERT,
49 this.onAlert); 49 this.onAlert);
50 this.addListener_(EventType.ARIA_ATTRIBUTE_CHANGED, 50 this.addListener_(EventType.ARIA_ATTRIBUTE_CHANGED,
51 this.onAriaAttributeChanged); 51 this.onAriaAttributeChanged);
52 this.addListener_(EventType.AUTOCORRECTION_OCCURED, 52 this.addListener_(EventType.AUTOCORRECTION_OCCURED,
53 this.onEventIfInRange); 53 this.onEventIfInRange);
54 this.addListener_(EventType.BLUR,
55 this.onBlur);
54 this.addListener_(EventType.CHECKED_STATE_CHANGED, 56 this.addListener_(EventType.CHECKED_STATE_CHANGED,
55 this.onCheckedStateChanged); 57 this.onCheckedStateChanged);
56 this.addListener_(EventType.CHILDREN_CHANGED, 58 this.addListener_(EventType.CHILDREN_CHANGED,
57 this.onChildrenChanged); 59 this.onChildrenChanged);
58 this.addListener_(EventType.EXPANDED_CHANGED, 60 this.addListener_(EventType.EXPANDED_CHANGED,
59 this.onEventIfInRange); 61 this.onEventIfInRange);
60 this.addListener_(EventType.FOCUS, 62 this.addListener_(EventType.FOCUS,
61 this.onFocus); 63 this.onFocus);
62 this.addListener_(EventType.HOVER, 64 this.addListener_(EventType.HOVER,
63 this.onHover); 65 this.onHover);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 onAlert: function(evt) { 238 onAlert: function(evt) {
237 var node = evt.target; 239 var node = evt.target;
238 if (!node || !this.shouldOutput_(evt)) 240 if (!node || !this.shouldOutput_(evt))
239 return; 241 return;
240 242
241 var range = cursors.Range.fromNode(node); 243 var range = cursors.Range.fromNode(node);
242 244
243 new Output().withSpeechAndBraille(range, null, evt.type).go(); 245 new Output().withSpeechAndBraille(range, null, evt.type).go();
244 }, 246 },
245 247
248 onBlur: function(evt) {
249 // Nullify focus if it no longer exists.
250 chrome.automation.getFocus(function(focus) {
251 if (!focus)
252 ChromeVoxState.instance.setCurrentRange(null);
253 });
254 },
255
246 /** 256 /**
247 * Provides all feedback once a checked state changed event fires. 257 * Provides all feedback once a checked state changed event fires.
248 * @param {!AutomationEvent} evt 258 * @param {!AutomationEvent} evt
249 */ 259 */
250 onCheckedStateChanged: function(evt) { 260 onCheckedStateChanged: function(evt) {
251 if (!AutomationPredicate.checkable(evt.target)) 261 if (!AutomationPredicate.checkable(evt.target))
252 return; 262 return;
253 263
254 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.CATEGORY_FLUSH); 264 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.CATEGORY_FLUSH);
255 var event = new CustomAutomationEvent( 265 var event = new CustomAutomationEvent(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 var savedRange = ChromeVoxState.instance.focusRecoveryMap.get(root); 321 var savedRange = ChromeVoxState.instance.focusRecoveryMap.get(root);
312 ChromeVoxState.instance.focusRecoveryMap.delete(root); 322 ChromeVoxState.instance.focusRecoveryMap.delete(root);
313 if (savedRange) { 323 if (savedRange) {
314 ChromeVoxState.instance.navigateToRange(savedRange, false); 324 ChromeVoxState.instance.navigateToRange(savedRange, false);
315 return; 325 return;
316 } 326 }
317 var event = new CustomAutomationEvent(EventType.FOCUS, node, evt.eventFrom); 327 var event = new CustomAutomationEvent(EventType.FOCUS, node, evt.eventFrom);
318 this.onEventDefault(event); 328 this.onEventDefault(event);
319 }, 329 },
320 330
331
yawano 2017/04/25 09:29:23 nit: unnecessary blank line
David Tseng 2017/04/25 22:48:03 Done.
321 /** 332 /**
322 * Provides all feedback once a load complete event fires. 333 * Provides all feedback once a load complete event fires.
323 * @param {!AutomationEvent} evt 334 * @param {!AutomationEvent} evt
324 */ 335 */
325 onLoadComplete: function(evt) { 336 onLoadComplete: function(evt) {
326 chrome.automation.getFocus(function(focus) { 337 chrome.automation.getFocus(function(focus) {
327 if (!focus || !AutomationUtil.isDescendantOf(focus, evt.target)) 338 if (!focus || !AutomationUtil.isDescendantOf(focus, evt.target))
328 return; 339 return;
329 340
330 // Create text edit handler, if needed, now in order not to miss initial 341 // Create text edit handler, if needed, now in order not to miss initial
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 DesktopAutomationHandler.init_ = function() { 572 DesktopAutomationHandler.init_ = function() {
562 chrome.automation.getDesktop(function(desktop) { 573 chrome.automation.getDesktop(function(desktop) {
563 ChromeVoxState.desktopAutomationHandler = 574 ChromeVoxState.desktopAutomationHandler =
564 new DesktopAutomationHandler(desktop); 575 new DesktopAutomationHandler(desktop);
565 }); 576 });
566 }; 577 };
567 578
568 DesktopAutomationHandler.init_(); 579 DesktopAutomationHandler.init_();
569 580
570 }); // goog.scope 581 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698