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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/node_state.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: 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 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 cvox.NodeState typedef. 6 * @fileoverview The cvox.NodeState typedef.
7 */ 7 */
8 8
9 goog.provide('cvox.NodeState'); 9 goog.provide('cvox.NodeState');
10 goog.provide('cvox.NodeStateUtil'); 10 goog.provide('cvox.NodeStateUtil');
(...skipping 16 matching lines...) Expand all
27 * 27 *
28 * NOTE(deboer): Once AriaUtil and DomUtil are using NodeState exclusively, this 28 * NOTE(deboer): Once AriaUtil and DomUtil are using NodeState exclusively, this
29 * function can be moved into DescriptionUtil, removing the cvox.ChromeVox 29 * function can be moved into DescriptionUtil, removing the cvox.ChromeVox
30 * dependency here. 30 * dependency here.
31 * 31 *
32 * @param {cvox.NodeState} state The node state. 32 * @param {cvox.NodeState} state The node state.
33 * @return {string} The readable state string. 33 * @return {string} The readable state string.
34 */ 34 */
35 cvox.NodeStateUtil.expand = function(state) { 35 cvox.NodeStateUtil.expand = function(state) {
36 try { 36 try {
37 return state.map(function(s) { 37 return state
38 if (s.length < 1) { 38 .map(function(s) {
39 throw new Error('cvox.NodeState must have at least one entry'); 39 if (s.length < 1) {
40 } 40 throw new Error('cvox.NodeState must have at least one entry');
41 var args = s.slice(1).map(function(a) { 41 }
42 if (typeof a == 'number') { 42 var args = s.slice(1).map(function(a) {
43 return Msgs.getNumber(a); 43 if (typeof a == 'number') {
44 } 44 return Msgs.getNumber(a);
45 return a; 45 }
46 }); 46 return a;
47 return Msgs.getMsg(/** @type {string} */ (s[0]), args); 47 });
48 }).join(' '); 48 return Msgs.getMsg(/** @type {string} */ (s[0]), args);
49 })
50 .join(' ');
49 } catch (e) { 51 } catch (e) {
50 throw new Error('error: ' + e + ' state: ' + state); 52 throw new Error('error: ' + e + ' state: ' + state);
51 } 53 }
52 }; 54 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698