Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1959)

Unified Diff: chrome/browser/resources/keyboard_overlay_accessibility_helper.js

Issue 7628018: Make keyboard overlay speak when ChromeVox is active (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix along review comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/keyboard_overlay.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/keyboard_overlay_accessibility_helper.js
diff --git a/chrome/browser/resources/keyboard_overlay_accessibility_helper.js b/chrome/browser/resources/keyboard_overlay_accessibility_helper.js
new file mode 100644
index 0000000000000000000000000000000000000000..c28a5001c2ceede9fae96f14d36943ae1c472a20
--- /dev/null
+++ b/chrome/browser/resources/keyboard_overlay_accessibility_helper.js
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// An object to implement keyboard overlay accessiblity.
+var KeyboardOverlayAccessibilityHelper = {
+ // Returns true when ChromeVox is loaded and active, false otherwise.
+ cvoxIsActive: function() {
+ return window.cvox && window.cvox.Api.isChromeVoxActive();
+ },
+ // Speaks all the shortcut with the given modifiers.
+ maybeSpeakAllShortcuts: function(modifiers) {
+ if (!this.cvoxIsActive())
+ return;
+ cvox.Api.stop();
+ var keyboardGlyphData = getKeyboardGlyphData();
+ var shortcutData = getShortcutData();
+ var layout = getLayouts()[keyboardGlyphData.layoutName];
+ var keysToShortcutText = {};
+ for (var i = 0; i < layout.length; ++i) {
+ var identifier = remapIdentifier(layout[i][0]);
+ var keyData = keyboardGlyphData.keys[identifier];
+ var keyLabel = getKeyLabel(keyData, modifiers);
+ var shortcutId = shortcutData[getAction(keyLabel, modifiers)];
+ var shortcutText = templateData[shortcutId];
+ var keysText = modifiers.concat(keyLabel).join(' + ');
+ if (shortcutText)
+ keysToShortcutText[keysText] = shortcutText;
+ }
+ for (var keysText in keysToShortcutText) {
+ this.speakShortcut_(keysText, keysToShortcutText[keysText]);
+ }
+ },
+ // Speaks given shortcut description.
+ speakShortcut_: function(keysText, shortcutText) {
+ keysText = keysText.toLowerCase(); // For correct pronunciation.
+ cvox.Api.speak(keysText, 1, {});
+ cvox.Api.speak(shortcutText, 1, {});
+ },
hashimoto 2011/08/16 07:54:56 Moved speakShortcut to the end part of the class b
+};
« no previous file with comments | « chrome/browser/resources/keyboard_overlay.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698