Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // An object to implement keyboard overlay accessiblity. | |
| 6 var KeyboardOverlayAccessibilityHelper = { | |
| 7 // Returns true when ChromeVox is loaded and active, false otherwise. | |
| 8 cvoxIsActive: function() { | |
| 9 return window.cvox && window.cvox.Api.isChromeVoxActive(); | |
| 10 }, | |
| 11 // Speaks all the shortcut with the given modifiers. | |
| 12 maybeSpeakAllShortcuts: function(modifiers) { | |
| 13 if (!this.cvoxIsActive()) | |
| 14 return; | |
| 15 cvox.Api.stop(); | |
| 16 var keyboardGlyphData = getKeyboardGlyphData(); | |
| 17 var shortcutData = getShortcutData(); | |
| 18 var layout = getLayouts()[keyboardGlyphData.layoutName]; | |
| 19 var keysToShortcutText = {}; | |
| 20 for (var i = 0; i < layout.length; ++i) { | |
| 21 var identifier = remapIdentifier(layout[i][0]); | |
| 22 var keyData = keyboardGlyphData.keys[identifier]; | |
| 23 var keyLabel = getKeyLabel(keyData, modifiers); | |
| 24 var shortcutId = shortcutData[getAction(keyLabel, modifiers)]; | |
| 25 var shortcutText = templateData[shortcutId]; | |
| 26 var keysText = modifiers.concat(keyLabel).join(' + '); | |
| 27 if (shortcutText) | |
| 28 keysToShortcutText[keysText] = shortcutText; | |
| 29 } | |
| 30 for (var keysText in keysToShortcutText) { | |
| 31 this.speakShortcut_(keysText, keysToShortcutText[keysText]); | |
| 32 } | |
| 33 }, | |
| 34 // Speaks given shortcut description. | |
| 35 speakShortcut_: function(keysText, shortcutText) { | |
| 36 keysText = keysText.toLowerCase(); // For correct pronunciation. | |
| 37 cvox.Api.speak(keysText, 1, {}); | |
| 38 cvox.Api.speak(shortcutText, 1, {}); | |
| 39 }, | |
|
hashimoto
2011/08/16 07:54:56
Moved speakShortcut to the end part of the class b
| |
| 40 }; | |
| OLD | NEW |