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

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

Issue 2366743004: Clean up Panel menu text labels. (Closed)
Patch Set: Rebase Created 4 years, 2 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
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 A drop-down menu in the ChromeVox panel. 6 * @fileoverview A drop-down menu in the ChromeVox panel.
7 */ 7 */
8 8
9 goog.provide('PanelMenu'); 9 goog.provide('PanelMenu');
10 goog.provide('PanelNodeMenu'); 10 goog.provide('PanelNodeMenu');
11 11
12 goog.require('Output');
12 goog.require('PanelMenuItem'); 13 goog.require('PanelMenuItem');
13 goog.require('constants'); 14 goog.require('constants');
15 goog.require('cursors.Range');
14 16
15 /** 17 /**
16 * @param {string} menuMsg The msg id of the menu. 18 * @param {string} menuMsg The msg id of the menu.
17 * @constructor 19 * @constructor
18 */ 20 */
19 PanelMenu = function(menuMsg) { 21 PanelMenu = function(menuMsg) {
20 /** @type {string} */ 22 /** @type {string} */
21 this.menuMsg = menuMsg; 23 this.menuMsg = menuMsg;
22 // The item in the menu bar containing the menu's title. 24 // The item in the menu bar containing the menu's title.
23 this.menuBarItemElement = document.createElement('div'); 25 this.menuBarItemElement = document.createElement('div');
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 PanelMenu.call(this, menuMsg); 236 PanelMenu.call(this, menuMsg);
235 var nodes = []; 237 var nodes = [];
236 var selectNext = false; 238 var selectNext = false;
237 var activeIndex = -1; 239 var activeIndex = -1;
238 AutomationUtil.findNodePre(node.root, constants.Dir.FORWARD, 240 AutomationUtil.findNodePre(node.root, constants.Dir.FORWARD,
239 /** @type {AutomationPredicate.Unary} */(function(n) { 241 /** @type {AutomationPredicate.Unary} */(function(n) {
240 if (n === node) 242 if (n === node)
241 selectNext = true; 243 selectNext = true;
242 244
243 if (pred(n)) { 245 if (pred(n)) {
244 this.addMenuItem(n.name, '', function() { 246 var output = new Output();
247 var range = cursors.Range.fromNode(n);
248 output.withSpeech(range, range, Output.EventType.NAVIGATE);
249 var label = output.toString();
250 this.addMenuItem(label, '', function() {
245 chrome.extension.getBackgroundPage().ChromeVoxState 251 chrome.extension.getBackgroundPage().ChromeVoxState
246 .instance['navigateToRange'](cursors.Range.fromNode(n)); 252 .instance['navigateToRange'](cursors.Range.fromNode(n));
247 }); 253 });
248 if (selectNext) { 254 if (selectNext) {
249 activeIndex = this.items_.length - 1; 255 activeIndex = this.items_.length - 1;
250 selectNext = false; 256 selectNext = false;
251 } 257 }
252 } 258 }
253 }).bind(this) 259 }).bind(this)
254 ); 260 );
(...skipping 10 matching lines...) Expand all
265 PanelNodeMenu.prototype = { 271 PanelNodeMenu.prototype = {
266 __proto__: PanelMenu.prototype, 272 __proto__: PanelMenu.prototype,
267 273
268 /** @override */ 274 /** @override */
269 activate: function() { 275 activate: function() {
270 var activeItem = this.activeIndex_; 276 var activeItem = this.activeIndex_;
271 PanelMenu.prototype.activate.call(this); 277 PanelMenu.prototype.activate.call(this);
272 this.activateItem(activeItem); 278 this.activateItem(activeItem);
273 } 279 }
274 }; 280 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698