Chromium Code Reviews| 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 'settings-languages-page' is the settings page | 6 * @fileoverview 'settings-languages-page' is the settings page |
| 7 * for language and input method settings. | 7 * for language and input method settings. |
| 8 */ | 8 */ |
| 9 (function() { | 9 (function() { |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 return this.languageHelper_.getLanguage( | 221 return this.languageHelper_.getLanguage( |
| 222 this.languageHelper_.getProspectiveUILanguage()).displayName; | 222 this.languageHelper_.getProspectiveUILanguage()).displayName; |
| 223 }, | 223 }, |
| 224 | 224 |
| 225 /** | 225 /** |
| 226 * Returns either the "selected" class, if the language matches the | 226 * Returns either the "selected" class, if the language matches the |
| 227 * prospective UI language, or an empty string. Languages can only be | 227 * prospective UI language, or an empty string. Languages can only be |
| 228 * selected on Chrome OS and Windows. | 228 * selected on Chrome OS and Windows. |
| 229 * @param {string} languageCode The language code identifying a language. | 229 * @param {string} languageCode The language code identifying a language. |
| 230 * @param {string} prospectiveUILanguage The prospective UI language. | 230 * @param {string} prospectiveUILanguage The prospective UI language. |
| 231 * @param {boolean} supportsUI Whether Chrome's UI can be shown in this | |
| 232 * language. | |
| 231 * @return {string} The class name for the language item. | 233 * @return {string} The class name for the language item. |
| 232 * @private | 234 * @private |
| 233 */ | 235 */ |
| 234 getLanguageItemClass_: function(languageCode, prospectiveUILanguage) { | 236 getLanguageItemClass_: function(languageCode, prospectiveUILanguage, |
|
dpapad
2016/06/23 23:44:22
Nit (optional): You could split this method in two
Dan Beam
2016/06/23 23:48:25
eh, it's a little bit better but i don't know of a
| |
| 235 if ((cr.isChromeOS || cr.isWindows) && | 237 supportsUI) { |
| 236 this.isProspectiveUILanguage_(languageCode, prospectiveUILanguage)) { | 238 var classes = []; |
| 237 return 'selected'; | 239 |
| 240 if (cr.isChromeOS || cr.isWindows) { | |
| 241 if (supportsUI) | |
| 242 classes.push('list-button'); // Makes the item look "actionable". | |
| 243 | |
| 244 if (this.isProspectiveUILanguage_(languageCode, prospectiveUILanguage)) | |
| 245 classes.push('selected'); | |
| 238 } | 246 } |
| 239 return ''; | 247 |
| 248 return classes.join(' '); | |
| 240 }, | 249 }, |
| 241 | 250 |
| 242 /** | 251 /** |
| 243 * @param {string} id The input method ID. | 252 * @param {string} id The input method ID. |
| 244 * @param {string} currentId The ID of the currently enabled input method. | 253 * @param {string} currentId The ID of the currently enabled input method. |
| 245 * @return {boolean} True if the IDs match. | 254 * @return {boolean} True if the IDs match. |
| 246 * @private | 255 * @private |
| 247 */ | 256 */ |
| 248 isCurrentInputMethod_: function(id, currentId) { | 257 isCurrentInputMethod_: function(id, currentId) { |
| 249 assert(cr.isChromeOS); | 258 assert(cr.isChromeOS); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 274 * HACK(michaelpg): This is necessary to show the list when navigating to | 283 * HACK(michaelpg): This is necessary to show the list when navigating to |
| 275 * the sub-page. Remove this function when PolymerElements/neon-animation#60 | 284 * the sub-page. Remove this function when PolymerElements/neon-animation#60 |
| 276 * is fixed. | 285 * is fixed. |
| 277 * @param {string} tagName Name of the element containing the <iron-list>. | 286 * @param {string} tagName Name of the element containing the <iron-list>. |
| 278 */ | 287 */ |
| 279 forceRenderList_: function(tagName) { | 288 forceRenderList_: function(tagName) { |
| 280 this.$$(tagName).$$('iron-list').fire('iron-resize'); | 289 this.$$(tagName).$$('iron-list').fire('iron-resize'); |
| 281 }, | 290 }, |
| 282 }); | 291 }); |
| 283 })(); | 292 })(); |
| OLD | NEW |