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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 onLoadComplete: function(evt) { | 290 onLoadComplete: function(evt) { |
291 chrome.automation.getFocus(function(focus) { | 291 chrome.automation.getFocus(function(focus) { |
292 if (!focus || !AutomationUtil.isDescendantOf(focus, evt.target)) | 292 if (!focus || !AutomationUtil.isDescendantOf(focus, evt.target)) |
293 return; | 293 return; |
294 | 294 |
295 // Create text edit handler, if needed, now in order not to miss initial | 295 // Create text edit handler, if needed, now in order not to miss initial |
296 // value change if text field has already been focused when initializing | 296 // value change if text field has already been focused when initializing |
297 // ChromeVox. | 297 // ChromeVox. |
298 this.createTextEditHandlerIfNeeded_(focus); | 298 this.createTextEditHandlerIfNeeded_(focus); |
299 | 299 |
| 300 // If auto read is set, skip focus recovery and start reading from the top
. |
| 301 if (localStorage['autoRead'] == 'true' && |
| 302 AutomationUtil.getTopLevelRoot(evt.target) == evt.target) { |
| 303 ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(evt.targe
t)); |
| 304 cvox.ChromeVox.tts.stop(); |
| 305 CommandHandler.onCommand('readFromHere'); |
| 306 return; |
| 307 } |
| 308 |
300 // If initial focus was already placed on this page (e.g. if a user starts | 309 // If initial focus was already placed on this page (e.g. if a user starts |
301 // tabbing before load complete), then don't move ChromeVox's position on | 310 // tabbing before load complete), then don't move ChromeVox's position on |
302 // the page. | 311 // the page. |
303 if (ChromeVoxState.instance.currentRange && | 312 if (ChromeVoxState.instance.currentRange && |
304 ChromeVoxState.instance.currentRange.start.node.root == focus.root) | 313 ChromeVoxState.instance.currentRange.start.node.root == focus.root) |
305 return; | 314 return; |
306 | 315 |
307 var o = new Output(); | 316 var o = new Output(); |
308 if (focus.role == RoleType.rootWebArea) { | 317 if (focus.role == RoleType.rootWebArea) { |
309 // Restore to previous position. | 318 // Restore to previous position. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 DesktopAutomationHandler.init_ = function() { | 527 DesktopAutomationHandler.init_ = function() { |
519 chrome.automation.getDesktop(function(desktop) { | 528 chrome.automation.getDesktop(function(desktop) { |
520 ChromeVoxState.desktopAutomationHandler = | 529 ChromeVoxState.desktopAutomationHandler = |
521 new DesktopAutomationHandler(desktop); | 530 new DesktopAutomationHandler(desktop); |
522 }); | 531 }); |
523 }; | 532 }; |
524 | 533 |
525 DesktopAutomationHandler.init_(); | 534 DesktopAutomationHandler.init_(); |
526 | 535 |
527 }); // goog.scope | 536 }); // goog.scope |
OLD | NEW |