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

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

Issue 2495373005: Record ChromeVox metrics (Closed)
Patch Set: Reword Accessibility.CrosChromeVoxNext description Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 ChromeVox commands. 6 * @fileoverview ChromeVox commands.
7 */ 7 */
8 8
9 goog.provide('CommandHandler'); 9 goog.provide('CommandHandler');
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ChromeVoxState.instance.mode == ChromeVoxMode.NEXT_COMPAT) 203 ChromeVoxState.instance.mode == ChromeVoxMode.NEXT_COMPAT)
204 return true; 204 return true;
205 205
206 var current = ChromeVoxState.instance.currentRange_; 206 var current = ChromeVoxState.instance.currentRange_;
207 var dir = Dir.FORWARD; 207 var dir = Dir.FORWARD;
208 var pred = null; 208 var pred = null;
209 var predErrorMsg = undefined; 209 var predErrorMsg = undefined;
210 var rootPred = AutomationPredicate.root; 210 var rootPred = AutomationPredicate.root;
211 var speechProps = {}; 211 var speechProps = {};
212 var skipSync = false; 212 var skipSync = false;
213 var didNavigate = false;
213 switch (command) { 214 switch (command) {
214 case 'nextCharacter': 215 case 'nextCharacter':
216 didNavigate = true;
215 speechProps['phoneticCharacters'] = true; 217 speechProps['phoneticCharacters'] = true;
216 current = current.move(cursors.Unit.CHARACTER, Dir.FORWARD); 218 current = current.move(cursors.Unit.CHARACTER, Dir.FORWARD);
217 break; 219 break;
218 case 'previousCharacter': 220 case 'previousCharacter':
221 didNavigate = true;
219 speechProps['phoneticCharacters'] = true; 222 speechProps['phoneticCharacters'] = true;
220 current = current.move(cursors.Unit.CHARACTER, Dir.BACKWARD); 223 current = current.move(cursors.Unit.CHARACTER, Dir.BACKWARD);
221 break; 224 break;
222 case 'nextWord': 225 case 'nextWord':
226 didNavigate = true;
223 current = current.move(cursors.Unit.WORD, Dir.FORWARD); 227 current = current.move(cursors.Unit.WORD, Dir.FORWARD);
224 break; 228 break;
225 case 'previousWord': 229 case 'previousWord':
230 didNavigate = true;
226 current = current.move(cursors.Unit.WORD, Dir.BACKWARD); 231 current = current.move(cursors.Unit.WORD, Dir.BACKWARD);
227 break; 232 break;
228 case 'forward': 233 case 'forward':
229 case 'nextLine': 234 case 'nextLine':
235 didNavigate = true;
230 current = current.move(cursors.Unit.LINE, Dir.FORWARD); 236 current = current.move(cursors.Unit.LINE, Dir.FORWARD);
231 break; 237 break;
232 case 'backward': 238 case 'backward':
233 case 'previousLine': 239 case 'previousLine':
240 didNavigate = true;
234 current = current.move(cursors.Unit.LINE, Dir.BACKWARD); 241 current = current.move(cursors.Unit.LINE, Dir.BACKWARD);
235 break; 242 break;
236 case 'nextButton': 243 case 'nextButton':
237 dir = Dir.FORWARD; 244 dir = Dir.FORWARD;
238 pred = AutomationPredicate.button; 245 pred = AutomationPredicate.button;
239 predErrorMsg = 'no_next_button'; 246 predErrorMsg = 'no_next_button';
240 break; 247 break;
241 case 'previousButton': 248 case 'previousButton':
242 dir = Dir.BACKWARD; 249 dir = Dir.BACKWARD;
243 pred = AutomationPredicate.button; 250 pred = AutomationPredicate.button;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 pred = AutomationPredicate.landmark; 405 pred = AutomationPredicate.landmark;
399 predErrorMsg = 'no_next_landmark'; 406 predErrorMsg = 'no_next_landmark';
400 break; 407 break;
401 case 'previousLandmark': 408 case 'previousLandmark':
402 dir = Dir.BACKWARD; 409 dir = Dir.BACKWARD;
403 pred = AutomationPredicate.landmark; 410 pred = AutomationPredicate.landmark;
404 predErrorMsg = 'no_previous_landmark'; 411 predErrorMsg = 'no_previous_landmark';
405 break; 412 break;
406 case 'right': 413 case 'right':
407 case 'nextObject': 414 case 'nextObject':
415 didNavigate = true;
408 current = current.move(cursors.Unit.NODE, Dir.FORWARD); 416 current = current.move(cursors.Unit.NODE, Dir.FORWARD);
409 break; 417 break;
410 case 'left': 418 case 'left':
411 case 'previousObject': 419 case 'previousObject':
420 didNavigate = true;
412 current = current.move(cursors.Unit.NODE, Dir.BACKWARD); 421 current = current.move(cursors.Unit.NODE, Dir.BACKWARD);
413 break; 422 break;
414 case 'previousGroup': 423 case 'previousGroup':
415 skipSync = true; 424 skipSync = true;
416 dir = Dir.BACKWARD; 425 dir = Dir.BACKWARD;
417 pred = AutomationPredicate.group; 426 pred = AutomationPredicate.group;
418 break; 427 break;
419 case 'nextGroup': 428 case 'nextGroup':
420 skipSync = true; 429 skipSync = true;
421 dir = Dir.FORWARD; 430 dir = Dir.FORWARD;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 var end = AutomationUtil.findNodePost(node, 665 var end = AutomationUtil.findNodePost(node,
657 command == 'goToLastCell' ? Dir.BACKWARD : Dir.FORWARD, 666 command == 'goToLastCell' ? Dir.BACKWARD : Dir.FORWARD,
658 AutomationPredicate.leaf); 667 AutomationPredicate.leaf);
659 if (end) 668 if (end)
660 current = cursors.Range.fromNode(end); 669 current = cursors.Range.fromNode(end);
661 break; 670 break;
662 default: 671 default:
663 return true; 672 return true;
664 } 673 }
665 674
675 if (didNavigate)
676 chrome.metricsPrivate.recordUserAction('Accessibility.ChromeVox.Navigate');
677
666 if (pred) { 678 if (pred) {
679 chrome.metricsPrivate.recordUserAction('Accessibility.ChromeVox.Jump');
680
667 var bound = current.getBound(dir).node; 681 var bound = current.getBound(dir).node;
668 if (bound) { 682 if (bound) {
669 var node = AutomationUtil.findNextNode( 683 var node = AutomationUtil.findNextNode(
670 bound, dir, pred, {skipInitialAncestry: true}); 684 bound, dir, pred, {skipInitialAncestry: true});
671 685
672 if (node && !skipSync) { 686 if (node && !skipSync) {
673 node = AutomationUtil.findNodePre( 687 node = AutomationUtil.findNodePre(
674 node, Dir.FORWARD, AutomationPredicate.object) || 688 node, Dir.FORWARD, AutomationPredicate.object) ||
675 node; 689 node;
676 } 690 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 break; 768 break;
755 } 769 }
756 if (announcement) { 770 if (announcement) {
757 cvox.ChromeVox.tts.speak( 771 cvox.ChromeVox.tts.speak(
758 announcement, cvox.QueueMode.FLUSH, 772 announcement, cvox.QueueMode.FLUSH,
759 cvox.AbstractTts.PERSONALITY_ANNOTATION); 773 cvox.AbstractTts.PERSONALITY_ANNOTATION);
760 } 774 }
761 }; 775 };
762 776
763 }); // goog.scope 777 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698