| 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 |
| 11 goog.require('AutomationObjectConstructorInstaller'); | 11 goog.require('AutomationObjectConstructorInstaller'); |
| 12 goog.require('BaseAutomationHandler'); | 12 goog.require('BaseAutomationHandler'); |
| 13 goog.require('ChromeVoxState'); | 13 goog.require('ChromeVoxState'); |
| 14 goog.require('Stubs'); |
| 14 goog.require('editing.TextEditHandler'); | 15 goog.require('editing.TextEditHandler'); |
| 15 | 16 |
| 16 goog.scope(function() { | 17 goog.scope(function() { |
| 17 var AutomationEvent = chrome.automation.AutomationEvent; | 18 var AutomationEvent = chrome.automation.AutomationEvent; |
| 18 var AutomationNode = chrome.automation.AutomationNode; | 19 var AutomationNode = chrome.automation.AutomationNode; |
| 19 var Dir = constants.Dir; | 20 var Dir = constants.Dir; |
| 20 var EventType = chrome.automation.EventType; | 21 var EventType = chrome.automation.EventType; |
| 21 var RoleType = chrome.automation.RoleType; | 22 var RoleType = chrome.automation.RoleType; |
| 22 | 23 |
| 23 /** | 24 /** |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (!node) | 95 if (!node) |
| 95 return; | 96 return; |
| 96 | 97 |
| 97 var prevRange = ChromeVoxState.instance.currentRange; | 98 var prevRange = ChromeVoxState.instance.currentRange; |
| 98 | 99 |
| 99 ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(node)); | 100 ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(node)); |
| 100 | 101 |
| 101 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 102 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
| 102 if (node.root.role != RoleType.desktop && | 103 if (node.root.role != RoleType.desktop && |
| 103 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) { | 104 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) { |
| 104 if (cvox.ChromeVox.isChromeOS) | 105 chrome.accessibilityPrivate.setFocusRing([]); |
| 105 chrome.accessibilityPrivate.setFocusRing([]); | |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Don't output if focused node hasn't changed. | 109 // Don't output if focused node hasn't changed. |
| 110 if (prevRange && | 110 if (prevRange && |
| 111 evt.type == 'focus' && | 111 evt.type == 'focus' && |
| 112 ChromeVoxState.instance.currentRange.equals(prevRange)) | 112 ChromeVoxState.instance.currentRange.equals(prevRange)) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 var output = new Output(); | 115 var output = new Output(); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 this.textEditHandler_ = editing.TextEditHandler.createForNode(node); | 393 this.textEditHandler_ = editing.TextEditHandler.createForNode(node); |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 }; | 396 }; |
| 397 | 397 |
| 398 /** | 398 /** |
| 399 * Initializes global state for DesktopAutomationHandler. | 399 * Initializes global state for DesktopAutomationHandler. |
| 400 * @private | 400 * @private |
| 401 */ | 401 */ |
| 402 DesktopAutomationHandler.init_ = function() { | 402 DesktopAutomationHandler.init_ = function() { |
| 403 if (cvox.ChromeVox.isMac) | |
| 404 return; | |
| 405 chrome.automation.getDesktop(function(desktop) { | 403 chrome.automation.getDesktop(function(desktop) { |
| 406 ChromeVoxState.desktopAutomationHandler = | 404 ChromeVoxState.desktopAutomationHandler = |
| 407 new DesktopAutomationHandler(desktop); | 405 new DesktopAutomationHandler(desktop); |
| 408 }); | 406 }); |
| 409 }; | 407 }; |
| 410 | 408 |
| 411 DesktopAutomationHandler.init_(); | 409 DesktopAutomationHandler.init_(); |
| 412 | 410 |
| 413 }); // goog.scope | 411 }); // goog.scope |
| OLD | NEW |