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

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

Issue 1277183003: Add ChromeVox panel and implement caption display functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish initial implementation for Chrome OS, address feedback Created 5 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 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 case 'showContextMenu': 368 case 'showContextMenu':
369 if (this.currentRange_) { 369 if (this.currentRange_) {
370 var actionNode = this.currentRange_.start.node; 370 var actionNode = this.currentRange_.start.node;
371 if (actionNode.role == RoleType.inlineTextBox) 371 if (actionNode.role == RoleType.inlineTextBox)
372 actionNode = actionNode.parent; 372 actionNode = actionNode.parent;
373 actionNode.showContextMenu(); 373 actionNode.showContextMenu();
374 return false; 374 return false;
375 } 375 }
376 break; 376 break;
377 case 'showOptionsPage': 377 case 'showOptionsPage':
378 var optionsPage = {url: 'chromevox/background/options.html'}; 378 this.showOptionsPage();
379 chrome.tabs.create(optionsPage);
380 break; 379 break;
381 case 'toggleChromeVoxVersion': 380 case 'toggleChromeVoxVersion':
382 var newMode; 381 var newMode;
383 if (this.mode_ == ChromeVoxMode.FORCE_NEXT) { 382 if (this.mode_ == ChromeVoxMode.FORCE_NEXT) {
384 var inViews = 383 var inViews =
385 this.currentRange_.start.node.root.role == RoleType.desktop; 384 this.currentRange_.start.node.root.role == RoleType.desktop;
386 newMode = inViews ? ChromeVoxMode.COMPAT : ChromeVoxMode.CLASSIC; 385 newMode = inViews ? ChromeVoxMode.COMPAT : ChromeVoxMode.CLASSIC;
387 } else { 386 } else {
388 newMode = ChromeVoxMode.FORCE_NEXT; 387 newMode = ChromeVoxMode.FORCE_NEXT;
389 } 388 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 426
428 new Output().withSpeechAndBraille( 427 new Output().withSpeechAndBraille(
429 this.currentRange_, prevRange, Output.EventType.NAVIGATE) 428 this.currentRange_, prevRange, Output.EventType.NAVIGATE)
430 .go(); 429 .go();
431 } 430 }
432 431
433 return false; 432 return false;
434 }, 433 },
435 434
436 /** 435 /**
436 * Open the options page in a new tab.
437 */
438 showOptionsPage: function() {
439 var optionsPage = {url: 'chromevox/background/options.html'};
440 chrome.tabs.create(optionsPage);
Peter Lundblad 2015/11/06 15:00:58 Just since you touch this, is chrome.runtime.openO
dmazzoni 2015/11/06 21:01:00 Thanks. Works great, but only if you call it from
441 },
442
443 /**
437 * Handles a braille command. 444 * Handles a braille command.
438 * @param {!cvox.BrailleKeyEvent} evt 445 * @param {!cvox.BrailleKeyEvent} evt
439 * @param {!cvox.NavBraille} content 446 * @param {!cvox.NavBraille} content
440 * @return {boolean} True if evt was processed. 447 * @return {boolean} True if evt was processed.
441 */ 448 */
442 onBrailleKeyEvent: function(evt, content) { 449 onBrailleKeyEvent: function(evt, content) {
443 if (this.mode_ === ChromeVoxMode.CLASSIC) 450 if (this.mode_ === ChromeVoxMode.CLASSIC)
444 return false; 451 return false;
445 452
446 switch (evt.command) { 453 switch (evt.command) {
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') 879 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&')
873 .replace(/\*/g, '.*') 880 .replace(/\*/g, '.*')
874 .replace(/\?/g, '.'); 881 .replace(/\?/g, '.');
875 }).join('|') + ')$'); 882 }).join('|') + ')$');
876 }; 883 };
877 884
878 /** @type {Background} */ 885 /** @type {Background} */
879 global.backgroundObj = new Background(); 886 global.backgroundObj = new Background();
880 887
881 }); // goog.scope 888 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698