Chromium Code Reviews| 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 = cvox.QueueMode.CATEGORY_FLUSH; |
|
dmazzoni
2015/10/13 20:20:40
Should this always be category flush? How about on
David Tseng
2015/10/13 21:27:59
Done.
| |
| 681 this.speechBuffer_.forEach(function(buff, i, a) { | 691 this.speechBuffer_.forEach(function(buff, i, a) { |
| 682 if (buff.toString()) { | 692 if (buff.toString()) { |
| 683 (function() { | 693 (function() { |
| 684 var scopedBuff = buff; | 694 var scopedBuff = buff; |
| 685 this.speechProperties_['startCallback'] = function() { | 695 this.speechProperties_['startCallback'] = function() { |
| 686 var actions = scopedBuff.getSpansInstanceOf(Output.Action); | 696 var actions = scopedBuff.getSpansInstanceOf(Output.Action); |
| 687 if (actions) { | 697 if (actions) { |
| 688 actions.forEach(function(a) { | 698 actions.forEach(function(a) { |
| 689 a.run(); | 699 a.run(); |
| 690 }); | 700 }); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1320 elem.end); | 1330 elem.end); |
| 1321 }); | 1331 }); |
| 1322 spansToRemove.forEach(result.removeSpan.bind(result)); | 1332 spansToRemove.forEach(result.removeSpan.bind(result)); |
| 1323 separator = Output.SPACE; | 1333 separator = Output.SPACE; |
| 1324 }); | 1334 }); |
| 1325 return result; | 1335 return result; |
| 1326 } | 1336 } |
| 1327 }; | 1337 }; |
| 1328 | 1338 |
| 1329 }); // goog.scope | 1339 }); // goog.scope |
| OLD | NEW |