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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js

Issue 1953913002: Revise accessibility for Date/TimeView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@skip_ancestor
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 cvox.ChromeVox.tts.speak( 628 cvox.ChromeVox.tts.speak(
629 announce, cvox.QueueMode.FLUSH, 629 announce, cvox.QueueMode.FLUSH,
630 cvox.AbstractTts.PERSONALITY_ANNOTATION); 630 cvox.AbstractTts.PERSONALITY_ANNOTATION);
631 return false; 631 return false;
632 case 'cyclePunctuationEcho': 632 case 'cyclePunctuationEcho':
633 cvox.ChromeVox.tts.speak(Msgs.getMsg( 633 cvox.ChromeVox.tts.speak(Msgs.getMsg(
634 global.backgroundTts.cyclePunctuationEcho()), 634 global.backgroundTts.cyclePunctuationEcho()),
635 cvox.QueueMode.FLUSH); 635 cvox.QueueMode.FLUSH);
636 return false; 636 return false;
637 case 'speakTimeAndDate': 637 case 'speakTimeAndDate':
638 var output = new Output(); 638 chrome.automation.getDesktop(function(d) {
639 var dateTime = new Date(); 639 // First, try speaking the on-screen time.
640 output.withString( 640 var allTime = d.findAll({role: RoleType.time});
dmazzoni 2016/05/06 15:53:14 Not for this change, but I think it'd be useful if
David Tseng 2016/05/06 20:40:14 Agreed; in this case, it would involve a leaf pred
641 dateTime.toLocaleTimeString() + 641 allTime.filter(function(t) {
642 ', ' + dateTime.toLocaleDateString()).go(); 642 return t.root.role == RoleType.desktop;
643 });
644
645 var timeString = '';
646 allTime.forEach(function(t) {
647 if (t.name)
648 timeString = t.name;
649 });
650 if (timeString) {
651 cvox.ChromeVox.tts.speak(timeString, cvox.QueueMode.FLUSH);
652 } else {
653 // Fallback to the old way of speaking time.
654 var output = new Output();
655 var dateTime = new Date();
656 output.withString(
657 dateTime.toLocaleTimeString() +
658 ', ' + dateTime.toLocaleDateString()).go();
659 }
660 });
643 return false; 661 return false;
644 case 'readCurrentTitle': 662 case 'readCurrentTitle':
645 var target = this.currentRange_.start.node; 663 var target = this.currentRange_.start.node;
646 var output = new Output(); 664 var output = new Output();
647 665
648 if (target.root.role == RoleType.rootWebArea) { 666 if (target.root.role == RoleType.rootWebArea) {
649 // Web. 667 // Web.
650 target = target.root; 668 target = target.root;
651 output.withString(target.name || target.docUrl); 669 output.withString(target.name || target.docUrl);
652 } else { 670 } else {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') 1029 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&')
1012 .replace(/\*/g, '.*') 1030 .replace(/\*/g, '.*')
1013 .replace(/\?/g, '.'); 1031 .replace(/\?/g, '.');
1014 }).join('|') + ')$'); 1032 }).join('|') + ')$');
1015 }; 1033 };
1016 1034
1017 /** @type {Background} */ 1035 /** @type {Background} */
1018 global.backgroundObj = new Background(); 1036 global.backgroundObj = new Background();
1019 1037
1020 }); // goog.scope 1038 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698