| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 */ | 91 */ |
| 92 onEventDefault: function(evt) { | 92 onEventDefault: function(evt) { |
| 93 var node = evt.target; | 93 var node = evt.target; |
| 94 if (!node) | 94 if (!node) |
| 95 return; | 95 return; |
| 96 | 96 |
| 97 var prevRange = ChromeVoxState.instance.currentRange; | 97 var prevRange = ChromeVoxState.instance.currentRange; |
| 98 | 98 |
| 99 ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(node)); | 99 ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(node)); |
| 100 | 100 |
| 101 // Check to see if we've crossed roots. Continue if we've crossed roots or | |
| 102 // are not within web content. | |
| 103 if (node.root.role == RoleType.desktop || | |
| 104 !prevRange || | |
| 105 prevRange.start.node.root != node.root) | |
| 106 ChromeVoxState.instance.refreshMode(node.root); | |
| 107 | |
| 108 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 101 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
| 109 if (node.root.role != RoleType.desktop && | 102 if (node.root.role != RoleType.desktop && |
| 110 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) { | 103 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) { |
| 111 if (cvox.ChromeVox.isChromeOS) | 104 if (cvox.ChromeVox.isChromeOS) |
| 112 chrome.accessibilityPrivate.setFocusRing([]); | 105 chrome.accessibilityPrivate.setFocusRing([]); |
| 113 return; | 106 return; |
| 114 } | 107 } |
| 115 | 108 |
| 116 // Don't output if focused node hasn't changed. | 109 // Don't output if focused node hasn't changed. |
| 117 if (prevRange && | 110 if (prevRange && |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 218 |
| 226 this.onEventDefault( | 219 this.onEventDefault( |
| 227 new chrome.automation.AutomationEvent(EventType.focus, node)); | 220 new chrome.automation.AutomationEvent(EventType.focus, node)); |
| 228 }, | 221 }, |
| 229 | 222 |
| 230 /** | 223 /** |
| 231 * Provides all feedback once a load complete event fires. | 224 * Provides all feedback once a load complete event fires. |
| 232 * @param {!AutomationEvent} evt | 225 * @param {!AutomationEvent} evt |
| 233 */ | 226 */ |
| 234 onLoadComplete: function(evt) { | 227 onLoadComplete: function(evt) { |
| 235 ChromeVoxState.instance.refreshMode(evt.target); | |
| 236 | |
| 237 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 228 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
| 238 if (evt.target.root.role != RoleType.desktop && | 229 if (evt.target.root.role != RoleType.desktop && |
| 239 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) | 230 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) |
| 240 return; | 231 return; |
| 241 | 232 |
| 242 chrome.automation.getFocus(function(focus) { | 233 chrome.automation.getFocus(function(focus) { |
| 243 if (!focus || !AutomationUtil.isDescendantOf(focus, evt.target)) | 234 if (!focus || !AutomationUtil.isDescendantOf(focus, evt.target)) |
| 244 return; | 235 return; |
| 245 | 236 |
| 246 // If initial focus was already placed on this page (e.g. if a user starts | 237 // If initial focus was already placed on this page (e.g. if a user starts |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 if (cvox.ChromeVox.isMac) | 403 if (cvox.ChromeVox.isMac) |
| 413 return; | 404 return; |
| 414 chrome.automation.getDesktop(function(desktop) { | 405 chrome.automation.getDesktop(function(desktop) { |
| 415 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); | 406 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); |
| 416 }); | 407 }); |
| 417 }; | 408 }; |
| 418 | 409 |
| 419 DesktopAutomationHandler.init_(); | 410 DesktopAutomationHandler.init_(); |
| 420 | 411 |
| 421 }); // goog.scope | 412 }); // goog.scope |
| OLD | NEW |