| OLD | NEW |
| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 for (var i = 0; i < roleListMenuMapping.length; ++i) { | 437 for (var i = 0; i < roleListMenuMapping.length; ++i) { |
| 438 var menuTitle = roleListMenuMapping[i].menuTitle; | 438 var menuTitle = roleListMenuMapping[i].menuTitle; |
| 439 var predicate = roleListMenuMapping[i].predicate; | 439 var predicate = roleListMenuMapping[i].predicate; |
| 440 // Create node menus asynchronously (because it may require searching a | 440 // Create node menus asynchronously (because it may require searching a |
| 441 // long document) unless that's the specific menu the | 441 // long document) unless that's the specific menu the |
| 442 // user requested. | 442 // user requested. |
| 443 var async = (menuTitle != opt_activateMenuTitle); | 443 var async = (menuTitle != opt_activateMenuTitle); |
| 444 Panel.addNodeMenu(menuTitle, node, predicate, async); | 444 Panel.addNodeMenu(menuTitle, node, predicate, async); |
| 445 } | 445 } |
| 446 | 446 |
| 447 // Add actions menu if there are custom actions. |
| 448 if (node.customActions && node.customActions.length > 0) { |
| 449 var actionsMenu = Panel.addMenu('panel_menu_actions'); |
| 450 for (var i = 0; i < node.customActions.length; i++) { |
| 451 var customAction = node.customActions[i]; |
| 452 actionsMenu.addMenuItem(customAction.description, |
| 453 '' /* menuItemShortcut */, '' /* menuItemBraille */, |
| 454 node.performCustomAction.bind(node, customAction.id)); |
| 455 } |
| 456 } |
| 457 |
| 447 // Activate either the specified menu or the first menu. | 458 // Activate either the specified menu or the first menu. |
| 448 var selectedMenu = Panel.menus_[0]; | 459 var selectedMenu = Panel.menus_[0]; |
| 449 for (var i = 0; i < Panel.menus_.length; i++) { | 460 for (var i = 0; i < Panel.menus_.length; i++) { |
| 450 if (this.menus_[i].menuMsg == opt_activateMenuTitle) | 461 if (this.menus_[i].menuMsg == opt_activateMenuTitle) |
| 451 selectedMenu = this.menus_[i]; | 462 selectedMenu = this.menus_[i]; |
| 452 } | 463 } |
| 453 Panel.activateMenu(selectedMenu); | 464 Panel.activateMenu(selectedMenu); |
| 454 }; | 465 }; |
| 455 | 466 |
| 456 /** Open incremental search. */ | 467 /** Open incremental search. */ |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 }, false); | 922 }, false); |
| 912 | 923 |
| 913 window.addEventListener('hashchange', function() { | 924 window.addEventListener('hashchange', function() { |
| 914 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 925 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
| 915 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 926 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
| 916 cvox.ChromeVox.isStickyPrefOn = false; | 927 cvox.ChromeVox.isStickyPrefOn = false; |
| 917 } else { | 928 } else { |
| 918 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 929 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
| 919 } | 930 } |
| 920 }, false); | 931 }, false); |
| OLD | NEW |