| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // The focused state gets set on the containing webView node. | 42 // The focused state gets set on the containing webView node. |
| 43 var webView = node.find({role: RoleType.webView, state: {focused: true}}); | 43 var webView = node.find({role: RoleType.webView, state: {focused: true}}); |
| 44 if (webView) { | 44 if (webView) { |
| 45 var root = webView.find({role: RoleType.rootWebArea}); | 45 var root = webView.find({role: RoleType.rootWebArea}); |
| 46 if (root) { | 46 if (root) { |
| 47 this.onLoadComplete( | 47 this.onLoadComplete( |
| 48 {target: root, | 48 {target: root, |
| 49 type: chrome.automation.EventType.loadComplete}); | 49 type: chrome.automation.EventType.loadComplete}); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 |
| 53 var focus = chrome.automation.getFocus(); |
| 54 if (focus) |
| 55 this.onFocus({target: focus, type: 'focus'}); |
| 52 }; | 56 }; |
| 53 | 57 |
| 54 DesktopAutomationHandler.prototype = { | 58 DesktopAutomationHandler.prototype = { |
| 55 __proto__: BaseAutomationHandler.prototype, | 59 __proto__: BaseAutomationHandler.prototype, |
| 56 | 60 |
| 57 /** @override */ | 61 /** @override */ |
| 58 willHandleEvent_: function(evt) { | 62 willHandleEvent_: function(evt) { |
| 59 return !cvox.ChromeVox.isActive; | 63 return !cvox.ChromeVox.isActive; |
| 60 }, | 64 }, |
| 61 | 65 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 this.onEventDefault( | 156 this.onEventDefault( |
| 153 /** @type {!AutomationEvent} */ | 157 /** @type {!AutomationEvent} */ |
| 154 ({target: node, type: chrome.automation.EventType.focus})); | 158 ({target: node, type: chrome.automation.EventType.focus})); |
| 155 }, | 159 }, |
| 156 | 160 |
| 157 /** | 161 /** |
| 158 * Provides all feedback once a load complete event fires. | 162 * Provides all feedback once a load complete event fires. |
| 159 * @param {Object} evt | 163 * @param {Object} evt |
| 160 */ | 164 */ |
| 161 onLoadComplete: function(evt) { | 165 onLoadComplete: function(evt) { |
| 166 console.log('onLoadComplete 1'); |
| 167 console.log('onLoadComplete 2'); |
| 168 |
| 162 ChromeVoxState.instance.refreshMode(evt.target.docUrl); | 169 ChromeVoxState.instance.refreshMode(evt.target.docUrl); |
| 170 console.log('onLoadComplete 3'); |
| 163 | 171 |
| 164 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 172 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
| 165 if (evt.target.root.role != RoleType.desktop && | 173 if (evt.target.root.role != RoleType.desktop && |
| 166 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) | 174 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) |
| 167 return; | 175 return; |
| 176 console.log('onLoadComplete 4'); |
| 168 | 177 |
| 169 // If initial focus was already placed on this page (e.g. if a user starts | 178 // If initial focus was already placed on this page (e.g. if a user starts |
| 170 // tabbing before load complete), then don't move ChromeVox's position on | 179 // tabbing before load complete), then don't move ChromeVox's position on |
| 171 // the page. | 180 // the page. |
| 172 if (ChromeVoxState.instance.currentRange && | 181 if (ChromeVoxState.instance.currentRange && |
| 173 ChromeVoxState.instance.currentRange.start.node.root == evt.target) | 182 ChromeVoxState.instance.currentRange.start.node.root == evt.target) |
| 174 return; | 183 return; |
| 184 console.log('onLoadComplete 5'); |
| 175 | 185 |
| 176 ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(evt.target)); | 186 ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(evt.target)); |
| 187 console.log('onLoadComplete 6'); |
| 188 |
| 177 new Output().withRichSpeechAndBraille( | 189 new Output().withRichSpeechAndBraille( |
| 178 ChromeVoxState.instance.currentRange, null, evt.type).go(); | 190 ChromeVoxState.instance.currentRange, null, evt.type).go(); |
| 191 console.log('onLoadComplete 7'); |
| 179 }, | 192 }, |
| 180 | 193 |
| 181 /** @override */ | 194 /** @override */ |
| 182 onTextChanged: function(evt) { | 195 onTextChanged: function(evt) { |
| 183 if (this.isEditable_(evt.target)) | 196 if (this.isEditable_(evt.target)) |
| 184 this.onEditableChanged_(evt); | 197 this.onEditableChanged_(evt); |
| 185 }, | 198 }, |
| 186 | 199 |
| 187 /** @override */ | 200 /** @override */ |
| 188 onTextSelectionChanged: function(evt) { | 201 onTextSelectionChanged: function(evt) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (cvox.ChromeVox.isMac) | 303 if (cvox.ChromeVox.isMac) |
| 291 return; | 304 return; |
| 292 chrome.automation.getDesktop(function(desktop) { | 305 chrome.automation.getDesktop(function(desktop) { |
| 293 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); | 306 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); |
| 294 }); | 307 }); |
| 295 }; | 308 }; |
| 296 | 309 |
| 297 DesktopAutomationHandler.init_(); | 310 DesktopAutomationHandler.init_(); |
| 298 | 311 |
| 299 }); // goog.scope | 312 }); // goog.scope |
| OLD | NEW |