OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Provides output services for ChromeVox. | 6 * @fileoverview Provides output services for ChromeVox. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('Output'); | 9 goog.provide('Output'); |
10 goog.provide('Output.EventType'); | 10 goog.provide('Output.EventType'); |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 * @param {chrome.automation.EventType|Output.EventType} type | 638 * @param {chrome.automation.EventType|Output.EventType} type |
639 * @return {!Output} | 639 * @return {!Output} |
640 */ | 640 */ |
641 withSpeechAndBraille: function(range, prevRange, type) { | 641 withSpeechAndBraille: function(range, prevRange, type) { |
642 this.withSpeech(range, prevRange, type); | 642 this.withSpeech(range, prevRange, type); |
643 this.withBraille(range, prevRange, type); | 643 this.withBraille(range, prevRange, type); |
644 return this; | 644 return this; |
645 }, | 645 }, |
646 | 646 |
647 /** | 647 /** |
| 648 * Applies the given speech category to the output. |
| 649 * @param {cvox.TtsCategory} category |
| 650 * @return {!Output} |
| 651 */ |
| 652 withSpeechCategory: function(category) { |
| 653 this.speechProperties_['category'] = category; |
| 654 return this; |
| 655 }, |
| 656 |
| 657 /** |
648 * Apply a format string directly to the output buffer. This lets you | 658 * Apply a format string directly to the output buffer. This lets you |
649 * output a message directly to the buffer using the format syntax. | 659 * output a message directly to the buffer using the format syntax. |
650 * @param {string} formatStr | 660 * @param {string} formatStr |
651 * @return {!Output} | 661 * @return {!Output} |
652 */ | 662 */ |
653 format: function(formatStr) { | 663 format: function(formatStr) { |
654 this.formatOptions_ = {speech: true, braille: false, location: true}; | 664 this.formatOptions_ = {speech: true, braille: false, location: true}; |
655 this.format_(null, formatStr, this.speechBuffer_); | 665 this.format_(null, formatStr, this.speechBuffer_); |
656 | 666 |
657 this.formatOptions_ = {speech: false, braille: true, location: false}; | 667 this.formatOptions_ = {speech: false, braille: true, location: false}; |
(...skipping 12 matching lines...) Expand all Loading... |
670 callback(); | 680 callback(); |
671 }.bind(this); | 681 }.bind(this); |
672 return this; | 682 return this; |
673 }, | 683 }, |
674 | 684 |
675 /** | 685 /** |
676 * Executes all specified output. | 686 * Executes all specified output. |
677 */ | 687 */ |
678 go: function() { | 688 go: function() { |
679 // Speech. | 689 // Speech. |
680 var queueMode = cvox.QueueMode.FLUSH; | 690 var queueMode = this.speechProperties_['category'] ? |
| 691 cvox.QueueMode.CATEGORY_FLUSH : cvox.QueueMode.FLUSH; |
681 this.speechBuffer_.forEach(function(buff, i, a) { | 692 this.speechBuffer_.forEach(function(buff, i, a) { |
682 if (buff.toString()) { | 693 if (buff.toString()) { |
683 (function() { | 694 (function() { |
684 var scopedBuff = buff; | 695 var scopedBuff = buff; |
685 this.speechProperties_['startCallback'] = function() { | 696 this.speechProperties_['startCallback'] = function() { |
686 var actions = scopedBuff.getSpansInstanceOf(Output.Action); | 697 var actions = scopedBuff.getSpansInstanceOf(Output.Action); |
687 if (actions) { | 698 if (actions) { |
688 actions.forEach(function(a) { | 699 actions.forEach(function(a) { |
689 a.run(); | 700 a.run(); |
690 }); | 701 }); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 elem.end); | 1331 elem.end); |
1321 }); | 1332 }); |
1322 spansToRemove.forEach(result.removeSpan.bind(result)); | 1333 spansToRemove.forEach(result.removeSpan.bind(result)); |
1323 separator = Output.SPACE; | 1334 separator = Output.SPACE; |
1324 }); | 1335 }); |
1325 return result; | 1336 return result; |
1326 } | 1337 } |
1327 }; | 1338 }; |
1328 | 1339 |
1329 }); // goog.scope | 1340 }); // goog.scope |
OLD | NEW |