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

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: Corrected wrong method call 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..cb8b53e4658cd7b4663ec31392ca13e176ceccae
--- /dev/null
+++ b/chrome/browser/resources/keyboard_overlay_accessibility_helper.js
@@ -0,0 +1,55 @@
+// 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() {
+ try {
+ if(cvox.Api.isChromeVoxActive())
dmazzoni 2011/08/12 21:26:09 Nit: Space after if
hashimoto 2011/08/15 05:00:33 Fixed On 2011/08/12 21:26:09, Dominic Mazzoni wro
+ return true;
+ } catch (e) {
+ if (!(e instanceof ReferenceError))
+ throw e;
+ }
+ return false;
+ },
+ // Speaks given string when ChromeVox is active, do nothing otherwise.
+ maybeSpeak: function(textString, queueMode, properties) {
+ if (this.cvoxIsActive())
+ cvox.Api.speak(textString, queueMode, properties);
+ },
+ // Stops speaking when ChromeVox is active, do nothing otherwise.
+ maybeStop: function() {
+ if (this.cvoxIsActive())
+ cvox.Api.stop();
+ },
+ // Speaks given shortcut description.
+ maybeSpeakShortcut: function(keysText, shortcutText) {
+ keysText = keysText.toLowerCase(); // For correct pronunciation.
+ this.maybeSpeak(keysText, 1, {rate: 0.5});
hashimoto 2011/08/15 05:00:33 Removed 'rate' parameter here because it does noth
+ this.maybeSpeak(shortcutText, 1, {});
+ },
+ // Speaks all the shortcut with the given modifiers.
+ maybeSpeakAllshortcuts: function(modifiers) {
dmazzoni 2011/08/12 21:26:09 Nit: Capital S: maybeSpeakAllshortcuts -> maybeSpe
hashimoto 2011/08/15 05:00:33 Fixed. On 2011/08/12 21:26:09, Dominic Mazzoni wr
+ this.maybeStop();
+ 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(' plus ');
dmazzoni 2011/08/12 21:26:09 I think you can use '+' here - I just tested and i
hashimoto 2011/08/15 05:00:33 Very good point, thanks. On 2011/08/12 21:26:09,
+ if (shortcutText)
+ keysToShortcutText[keysText] = shortcutText;
+ }
+ for (var keysText in keysToShortcutText) {
+ this.maybeSpeakShortcut(keysText, keysToShortcutText[keysText]);
+ }
+ }
+};
« 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