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 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'); |
| 11 goog.provide('global'); | 11 goog.provide('global'); |
| 12 | 12 |
| 13 goog.require('AutomationPredicate'); | 13 goog.require('AutomationPredicate'); |
| 14 goog.require('AutomationUtil'); | 14 goog.require('AutomationUtil'); |
| 15 goog.require('ClassicCompatibility'); | 15 goog.require('ClassicCompatibility'); |
| 16 goog.require('Cvox2EarconsBackground'); | |
| 16 goog.require('Output'); | 17 goog.require('Output'); |
| 17 goog.require('Output.EventType'); | 18 goog.require('Output.EventType'); |
| 18 goog.require('cursors.Cursor'); | 19 goog.require('cursors.Cursor'); |
| 19 goog.require('cvox.BrailleKeyCommand'); | 20 goog.require('cvox.BrailleKeyCommand'); |
| 20 goog.require('cvox.ChromeVoxEditableTextBase'); | 21 goog.require('cvox.ChromeVoxEditableTextBase'); |
| 22 goog.require('cvox.EarconsBackground'); | |
| 21 goog.require('cvox.ExtensionBridge'); | 23 goog.require('cvox.ExtensionBridge'); |
| 22 goog.require('cvox.NavBraille'); | 24 goog.require('cvox.NavBraille'); |
| 23 | 25 |
| 24 goog.scope(function() { | 26 goog.scope(function() { |
| 25 var AutomationNode = chrome.automation.AutomationNode; | 27 var AutomationNode = chrome.automation.AutomationNode; |
| 26 var Dir = AutomationUtil.Dir; | 28 var Dir = AutomationUtil.Dir; |
| 27 var EventType = chrome.automation.EventType; | 29 var EventType = chrome.automation.EventType; |
| 28 var RoleType = chrome.automation.RoleType; | 30 var RoleType = chrome.automation.RoleType; |
| 29 | 31 |
| 30 /** | 32 /** |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 var url = msg['url']; | 111 var url = msg['url']; |
| 110 var isClassicEnabled = this.shouldEnableClassicForUrl_(url); | 112 var isClassicEnabled = this.shouldEnableClassicForUrl_(url); |
| 111 port.postMessage({ | 113 port.postMessage({ |
| 112 target: 'next', | 114 target: 'next', |
| 113 isClassicEnabled: isClassicEnabled | 115 isClassicEnabled: isClassicEnabled |
| 114 }); | 116 }); |
| 115 } | 117 } |
| 116 break; | 118 break; |
| 117 } | 119 } |
| 118 }.bind(this)); | 120 }.bind(this)); |
| 121 | |
| 122 /** @type {!cvox.AbstractEarcons} @private */ | |
| 123 this.classicEarcons_ = new cvox.EarconsBackground(); | |
| 124 | |
| 125 /** @type {!cvox.AbstractEarcons} @private */ | |
| 126 this.nextEarcons_ = new Cvox2EarconsBackground(); | |
| 119 }; | 127 }; |
| 120 | 128 |
| 121 Background.prototype = { | 129 Background.prototype = { |
| 122 /** Forces ChromeVox Next to be active for all tabs. */ | 130 /** Forces ChromeVox Next to be active for all tabs. */ |
| 123 forceChromeVoxNextActive: function() { | 131 forceChromeVoxNextActive: function() { |
| 124 this.setChromeVoxMode(ChromeVoxMode.FORCE_NEXT); | 132 this.setChromeVoxMode(ChromeVoxMode.FORCE_NEXT); |
| 125 }, | 133 }, |
| 126 | 134 |
| 127 /** | 135 /** |
| 128 * Handles all setup once a new automation tree appears. | 136 * Handles all setup once a new automation tree appears. |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 701 } else { | 709 } else { |
| 702 // When in compat mode, if the focus is within the desktop tree proper, | 710 // When in compat mode, if the focus is within the desktop tree proper, |
| 703 // then do not disable content scripts. | 711 // then do not disable content scripts. |
| 704 if (this.currentRange_.start.node.root.role == 'desktop') | 712 if (this.currentRange_.start.node.root.role == 'desktop') |
| 705 return; | 713 return; |
| 706 | 714 |
| 707 this.disableClassicChromeVox_(); | 715 this.disableClassicChromeVox_(); |
| 708 } | 716 } |
| 709 }.bind(this)); | 717 }.bind(this)); |
| 710 | 718 |
| 719 if (mode === ChromeVoxMode.FORCE_NEXT || mode === ChromeVoxMode.NEXT) { | |
|
Peter Lundblad
2015/09/07 21:15:52
I think this means that classic could play cvox2 e
dmazzoni
2015/09/07 23:43:04
My intent here is that you get classic earcons in
| |
| 720 cvox.ChromeVox.earcons = this.nextEarcons_; | |
| 721 } else { | |
| 722 cvox.ChromeVox.earcons = this.classicEarcons_; | |
| 723 } | |
| 724 | |
| 711 this.mode_ = mode; | 725 this.mode_ = mode; |
| 712 }, | 726 }, |
| 713 | 727 |
| 714 /** | 728 /** |
| 715 * @param {!cvox.Spannable} text | 729 * @param {!cvox.Spannable} text |
| 716 * @param {number} position | 730 * @param {number} position |
| 717 * @private | 731 * @private |
| 718 */ | 732 */ |
| 719 brailleRoutingCommand_: function(text, position) { | 733 brailleRoutingCommand_: function(text, position) { |
| 720 var actionNode = null; | 734 var actionNode = null; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 755 node.state.protected, | 769 node.state.protected, |
| 756 cvox.ChromeVox.tts); | 770 cvox.ChromeVox.tts); |
| 757 } | 771 } |
| 758 } | 772 } |
| 759 }; | 773 }; |
| 760 | 774 |
| 761 /** @type {Background} */ | 775 /** @type {Background} */ |
| 762 global.backgroundObj = new Background(); | 776 global.backgroundObj = new Background(); |
| 763 | 777 |
| 764 }); // goog.scope | 778 }); // goog.scope |
| OLD | NEW |