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 custom actions. | |
448 var customActionsMenu = Panel.addMenu('panel_menu_custom_actions'); | |
449 if (node.customActions && node.customActions.length > 0) { | |
450 for (var i = 0; i < node.customActions.length; i++) { | |
451 var customAction = node.customActions[i]; | |
452 customActionsMenu.addMenuItem(customAction.description, | |
453 '' /* menuItemShortcut */, '' /* menuItemBraille */, | |
454 node.performCustomAction.bind(node, customAction.id)); | |
455 } | |
456 } else { | |
David Tseng
2017/06/06 18:12:39
I would prefer not adding the menu at all.
yawano
2017/06/08 09:25:28
Done. Changed not to show the menu if there is no
| |
457 customActionsMenu.addMenuItem(Msgs.getMsg('panel_menu_item_none'), | |
458 '' /* menuItemShortcut */, '' /* menuItemBraille */, | |
459 null /* callback */); | |
460 } | |
461 | |
447 // Activate either the specified menu or the first menu. | 462 // Activate either the specified menu or the first menu. |
448 var selectedMenu = Panel.menus_[0]; | 463 var selectedMenu = Panel.menus_[0]; |
449 for (var i = 0; i < Panel.menus_.length; i++) { | 464 for (var i = 0; i < Panel.menus_.length; i++) { |
450 if (this.menus_[i].menuMsg == opt_activateMenuTitle) | 465 if (this.menus_[i].menuMsg == opt_activateMenuTitle) |
451 selectedMenu = this.menus_[i]; | 466 selectedMenu = this.menus_[i]; |
452 } | 467 } |
453 Panel.activateMenu(selectedMenu); | 468 Panel.activateMenu(selectedMenu); |
454 }; | 469 }; |
455 | 470 |
456 /** Open incremental search. */ | 471 /** Open incremental search. */ |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
911 }, false); | 926 }, false); |
912 | 927 |
913 window.addEventListener('hashchange', function() { | 928 window.addEventListener('hashchange', function() { |
914 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 929 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
915 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 930 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
916 cvox.ChromeVox.isStickyPrefOn = false; | 931 cvox.ChromeVox.isStickyPrefOn = false; |
917 } else { | 932 } else { |
918 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 933 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
919 } | 934 } |
920 }, false); | 935 }, false); |
OLD | NEW |