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 The entry point for all ChromeVox2 related code for the | 6 * @fileoverview The entry point for all ChromeVox2 related code for the |
7 * background page. | 7 * background page. |
8 */ | 8 */ |
9 | 9 |
10 goog.provide('Background'); | 10 goog.provide('Background'); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 get: function() { | 115 get: function() { |
116 return localStorage['active'] !== 'false'; | 116 return localStorage['active'] !== 'false'; |
117 }, | 117 }, |
118 set: function(value) { | 118 set: function(value) { |
119 localStorage['active'] = value; | 119 localStorage['active'] = value; |
120 } | 120 } |
121 }); | 121 }); |
122 | 122 |
123 cvox.ExtensionBridge.addMessageListener(this.onMessage_); | 123 cvox.ExtensionBridge.addMessageListener(this.onMessage_); |
124 | 124 |
125 document.addEventListener('keydown', this.onKeyDown.bind(this), true); | 125 document.addEventListener('keydown', this.onKeyDown.bind(this), false); |
126 document.addEventListener('keyup', this.onKeyUp.bind(this), true); | 126 document.addEventListener('keyup', this.onKeyUp.bind(this), false); |
127 cvox.ChromeVoxKbHandler.commandHandler = this.onGotCommand.bind(this); | 127 cvox.ChromeVoxKbHandler.commandHandler = this.onGotCommand.bind(this); |
128 | 128 |
129 // Classic keymap. | 129 // Classic keymap. |
130 cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromDefaults(); | 130 cvox.ChromeVoxKbHandler.handlerKeyMap = cvox.KeyMap.fromDefaults(); |
131 | 131 |
132 // Live region handler. | 132 // Live region handler. |
133 this.liveRegions_ = new LiveRegions(this); | 133 this.liveRegions_ = new LiveRegions(this); |
134 | 134 |
135 /** @type {number} @private */ | 135 /** @type {number} @private */ |
136 this.passThroughKeyUpCount_ = 0; | 136 this.passThroughKeyUpCount_ = 0; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 break; | 529 break; |
530 case 'increaseTtsPitch': | 530 case 'increaseTtsPitch': |
531 this.increaseOrDecreaseSpeechProperty_(cvox.AbstractTts.PITCH, true); | 531 this.increaseOrDecreaseSpeechProperty_(cvox.AbstractTts.PITCH, true); |
532 break; | 532 break; |
533 case 'decreaseTtsVolume': | 533 case 'decreaseTtsVolume': |
534 this.increaseOrDecreaseSpeechProperty_(cvox.AbstractTts.VOLUME, false); | 534 this.increaseOrDecreaseSpeechProperty_(cvox.AbstractTts.VOLUME, false); |
535 break; | 535 break; |
536 case 'increaseTtsVolume': | 536 case 'increaseTtsVolume': |
537 this.increaseOrDecreaseSpeechProperty_(cvox.AbstractTts.VOLUME, true); | 537 this.increaseOrDecreaseSpeechProperty_(cvox.AbstractTts.VOLUME, true); |
538 break; | 538 break; |
539 case 'stopSpeech': | |
540 cvox.ChromeVox.tts.stop(); | |
dmazzoni
2016/02/17 04:57:15
Just checking, does this stop continuous reading a
David Tseng
2016/02/17 19:30:11
Set the global.isReading flag to false. It looks l
| |
541 return false; | |
539 default: | 542 default: |
540 return true; | 543 return true; |
541 } | 544 } |
542 | 545 |
543 if (pred) { | 546 if (pred) { |
544 var node = AutomationUtil.findNextNode( | 547 var node = AutomationUtil.findNextNode( |
545 current.getBound(dir).node, dir, pred); | 548 current.getBound(dir).node, dir, pred); |
546 | 549 |
547 if (node) { | 550 if (node) { |
548 current = cursors.Range.fromNode(node); | 551 current = cursors.Range.fromNode(node); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
832 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') | 835 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') |
833 .replace(/\*/g, '.*') | 836 .replace(/\*/g, '.*') |
834 .replace(/\?/g, '.'); | 837 .replace(/\?/g, '.'); |
835 }).join('|') + ')$'); | 838 }).join('|') + ')$'); |
836 }; | 839 }; |
837 | 840 |
838 /** @type {Background} */ | 841 /** @type {Background} */ |
839 global.backgroundObj = new Background(); | 842 global.backgroundObj = new Background(); |
840 | 843 |
841 }); // goog.scope | 844 }); // goog.scope |
OLD | NEW |