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

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

Issue 2873373005: Add custom action support (Closed)
Patch Set: Migrate to DataObjectBuilder. Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 ChromeVox panel and menus. 6 * @fileoverview The ChromeVox panel and menus.
7 */ 7 */
8 8
9 goog.provide('Panel'); 9 goog.provide('Panel');
10 10
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 for (var i = 0; i < roleListMenuMapping.length; ++i) { 439 for (var i = 0; i < roleListMenuMapping.length; ++i) {
440 var menuTitle = roleListMenuMapping[i].menuTitle; 440 var menuTitle = roleListMenuMapping[i].menuTitle;
441 var predicate = roleListMenuMapping[i].predicate; 441 var predicate = roleListMenuMapping[i].predicate;
442 // Create node menus asynchronously (because it may require searching a 442 // Create node menus asynchronously (because it may require searching a
443 // long document) unless that's the specific menu the 443 // long document) unless that's the specific menu the
444 // user requested. 444 // user requested.
445 var async = (menuTitle != opt_activateMenuTitle); 445 var async = (menuTitle != opt_activateMenuTitle);
446 Panel.addNodeMenu(menuTitle, node, predicate, async); 446 Panel.addNodeMenu(menuTitle, node, predicate, async);
447 } 447 }
448 448
449 // Add actions menu if there are custom actions.
450 if (node.customActions && node.customActions.length > 0) {
451 var actionsMenu = Panel.addMenu('panel_menu_actions');
452 for (var i = 0; i < node.customActions.length; i++) {
453 var customAction = node.customActions[i];
454 actionsMenu.addMenuItem(customAction.description,
455 '' /* menuItemShortcut */, '' /* menuItemBraille */,
456 node.performCustomAction.bind(node, customAction.id));
457 }
458 }
459
449 // Activate either the specified menu or the first menu. 460 // Activate either the specified menu or the first menu.
450 var selectedMenu = Panel.menus_[0]; 461 var selectedMenu = Panel.menus_[0];
451 for (var i = 0; i < Panel.menus_.length; i++) { 462 for (var i = 0; i < Panel.menus_.length; i++) {
452 if (this.menus_[i].menuMsg == opt_activateMenuTitle) 463 if (this.menus_[i].menuMsg == opt_activateMenuTitle)
453 selectedMenu = this.menus_[i]; 464 selectedMenu = this.menus_[i];
454 } 465 }
455 Panel.activateMenu(selectedMenu); 466 Panel.activateMenu(selectedMenu);
456 }; 467 };
457 468
458 /** Open incremental search. */ 469 /** Open incremental search. */
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 }, false); 924 }, false);
914 925
915 window.addEventListener('hashchange', function() { 926 window.addEventListener('hashchange', function() {
916 if (location.hash == '#fullscreen' || location.hash == '#focus') { 927 if (location.hash == '#fullscreen' || location.hash == '#focus') {
917 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; 928 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn;
918 cvox.ChromeVox.isStickyPrefOn = false; 929 cvox.ChromeVox.isStickyPrefOn = false;
919 } else { 930 } else {
920 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; 931 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_;
921 } 932 }
922 }, false); 933 }, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698